|
1 |
| - |
2 |
| -name: Cli-core Build |
3 |
| - |
| 1 | +name: Cli-core Release |
4 | 2 | on:
|
5 |
| -# repository_dispatch: |
6 |
| -# types: [ releaseCliCore ] |
7 |
| -# push: |
8 |
| -# branches: [ test_branch_actions ] |
9 | 3 | workflow_dispatch:
|
10 | 4 | inputs:
|
11 |
| - cliBranch: |
| 5 | + cli-branch: |
12 | 6 | description: 'Run workflow in the branch'
|
13 | 7 | default: main
|
14 |
| - |
15 | 8 | jobs:
|
16 |
| - build: |
| 9 | + test: |
17 | 10 | runs-on: ubuntu-latest
|
18 | 11 | strategy:
|
19 | 12 | matrix:
|
20 | 13 | node-version: [10.x]
|
21 | 14 | steps:
|
22 |
| - - uses: actions/checkout@v2 |
23 |
| - - run: npm install |
24 |
| - - name: Use Node.js ${{ matrix.node-version }} |
25 |
| - uses: actions/setup-node@v2 |
26 |
| - with: |
27 |
| - node-version: ${{ matrix.node-version }} |
28 |
| - cache: 'npm' |
29 |
| - - run: npm ci |
30 |
| - - run: npm test |
31 |
| - updateAPIDefinitions: |
| 15 | + - name: Checkout to cli-core repo |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - run: npm install |
| 18 | + - name: Use Node.js ${{ matrix.node-version }} |
| 19 | + uses: actions/setup-node@v2 |
| 20 | + with: |
| 21 | + node-version: ${{ matrix.node-version }} |
| 22 | + cache: 'npm' |
| 23 | + - name: Run tests |
| 24 | + run: | |
| 25 | + npm ci |
| 26 | + npm test |
| 27 | + update-api-specs: |
32 | 28 | runs-on: ubuntu-latest
|
33 |
| - needs: [build] |
| 29 | + needs: [test] |
34 | 30 | outputs:
|
35 |
| - changeLog: ${{ steps.updateFolder.outputs.changeLog }} |
36 |
| - versionType: ${{ steps.updateFolder.outputs.versionType }} |
| 31 | + change-log: ${{ steps.update-specs.outputs.change-log }} |
| 32 | + version-type: ${{ steps.update-specs.outputs.version-type }} |
37 | 33 | steps:
|
38 |
| - - run: mkdir -p ~/oai_definitions/json |
39 |
| - - run: cd ~/oai_definitions |
40 |
| - - run: pwd |
41 |
| - - run: ls |
42 |
| - - uses: actions/checkout@v2 |
43 |
| - with: |
44 |
| - repository: 'LakshmiRavali/twilio-oai' |
45 |
| - token: ${{ secrets.OAI_TOKEN }} |
46 |
| - - run: | |
47 |
| - cp -R spec/json/. ~/oai_definitions/json/ |
48 |
| - cp -R CHANGES.md ~/oai_definitions/CHANGES.md |
49 |
| - - uses: actions/checkout@v2 |
50 |
| - - name: Update OAI folder |
51 |
| - id: updateFolder |
52 |
| -# run: | |
53 |
| -# echo "::set-output name=changeLog::$(git branch --show-current)" |
54 |
| -# - run: echo ${{ steps.updateFolder.outputs.changeLog}} |
55 |
| - run: | |
56 |
| - npm install |
57 |
| - cp -R ~/oai_definitions/CHANGES.md OAI_CHANGES.md |
58 |
| - source scripts/updateApiDefinitions.sh |
59 |
| - echo "::set-output name=changeLog::$changeLog" |
60 |
| - echo "::set-output name=versionType::$versionType" |
| 34 | + - name: Create temporary folder for copying json files fom OAI repo |
| 35 | + - run: mkdir -p ~/oai_definitions/json |
| 36 | + - name: Checkout to OAI repo |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + with: |
| 39 | + repository: 'LakshmiRavali/twilio-oai' |
| 40 | + token: ${{ secrets.OAI_TOKEN }} |
| 41 | + - run: | |
| 42 | + cp -R spec/json/. ~/oai_definitions/json/ |
| 43 | + cp -R CHANGES.md ~/oai_definitions/CHANGES.md |
| 44 | + - name: Checkout to cli-core repo |
| 45 | + - uses: actions/checkout@v2 |
| 46 | + - name: Update OAI specs |
| 47 | + id: update-specs |
| 48 | + run: | |
| 49 | + npm install |
| 50 | + cp -R ~/oai_definitions/CHANGES.md OAI_CHANGES.md |
| 51 | + source scripts/updateApiDefinitions.sh |
| 52 | + echo "::set-output name=change-log::$changeLog" |
| 53 | + echo "::set-output name=version-type::$versionType" |
61 | 54 | release:
|
62 | 55 | runs-on: ubuntu-latest
|
63 |
| - needs: [updateAPIDefinitions] |
| 56 | + needs: [update-api-specs] |
64 | 57 | steps:
|
65 |
| - - uses: actions/checkout@v2 |
66 |
| - - run: git pull |
67 |
| - - run: git branch |
68 |
| - - run: git log -3 |
69 |
| - - run: npm install |
70 |
| - - name: Use Node.js ${{ matrix.node-version }} |
71 |
| - uses: actions/setup-node@v2 |
72 |
| - with: |
73 |
| - node-version: ${{ matrix.node-version }} |
74 |
| - cache: 'npm' |
75 |
| - - name: semanticRelease |
76 |
| - run: npm install --save-dev @semantic-release/changelog @semantic-release/git |
77 |
| - - run: npm ci && npx semantic-release -t \${version} |
78 |
| - env: |
79 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
80 |
| - updateRelease: |
| 58 | + - name: Checkout to cli-core repo |
| 59 | + - uses: actions/checkout@v2 |
| 60 | + run: | |
| 61 | + git pull |
| 62 | + npm install |
| 63 | + - name: Use Node.js ${{ matrix.node-version }} |
| 64 | + uses: actions/setup-node@v2 |
| 65 | + with: |
| 66 | + node-version: ${{ matrix.node-version }} |
| 67 | + cache: 'npm' |
| 68 | + - name: semanticRelease |
| 69 | + run: | |
| 70 | + npm install --save-dev @semantic-release/changelog @semantic-release/git |
| 71 | + npm ci && npx semantic-release -t \${version} |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + update-release: |
81 | 75 | runs-on: ubuntu-latest
|
82 |
| - strategy: |
83 |
| - matrix: |
84 |
| - node-version: [10.x] |
85 |
| - needs: [updateAPIDefinitions, release] |
86 |
| - steps: |
| 76 | + needs: [update-api-specs, release] |
| 77 | + steps: |
| 78 | + - name: Checkout to cli-core repo |
87 | 79 | - uses: actions/checkout@v2
|
88 | 80 | - run: git fetch --tags
|
89 |
| - - name: Getting tag |
90 |
| - id: test |
| 81 | + - name: Getting latest tag |
| 82 | + id: get-tag |
91 | 83 | run: |
|
92 | 84 | echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))"
|
93 |
| - - run: echo "${{steps.test.outputs.TAG_NAME}}" |
94 |
| - - name: update release |
95 |
| - id: update_release |
| 85 | + - run: echo "${{steps.get-tag.outputs.TAG_NAME}}" |
| 86 | + - name: Update release |
96 | 87 |
|
97 | 88 | env:
|
98 | 89 | GITHUB_TOKEN: ${{ github.token }}
|
99 |
| - TAG_NAME: ${{steps.test.outputs.TAG_NAME}} |
| 90 | + TAG_NAME: ${{steps.get-tag.outputs.TAG_NAME}} |
100 | 91 | with:
|
101 | 92 | is_append_body: true
|
102 |
| - body: "${{needs.updateAPIDefinitions.outputs.changeLog}}" |
| 93 | + body: ${{needs.update-api-specs.outputs.change-log}} |
103 | 94 | triggerCliWorkflow:
|
104 |
| - runs-on: ubuntu-latest |
105 |
| - needs: [ updateAPIDefinitions, updateRelease ] |
106 |
| - steps: |
107 |
| - - name: Invoke CLI workflow with changelog |
| 95 | + runs-on: ubuntu-latest |
| 96 | + needs: [ update-api-specs, update-release] |
| 97 | + steps: |
| 98 | + - name: Invoke CLI workflow with changelog and version-type |
108 | 99 | uses: benc-uk/workflow-dispatch@v1
|
109 | 100 | with:
|
110 |
| - workflow: Cli Publish |
111 |
| - token: ${{ secrets.REPO_ACCESS_TOKEN }} |
| 101 | + workflow: Cli Release |
| 102 | + token: ${{ secrets.CLI_ACCESS_TOKEN }} |
112 | 103 | repo: LakshmiRavali/twilio-cli
|
113 |
| - ref: "${{ github.event.inputs.cliBranch }}" |
114 |
| - inputs: '{ "changeLog": ${{ toJSON(needs.updateAPIDefinitions.outputs.changeLog) }}, "versionType": "${{needs.updateAPIDefinitions.outputs.versionType}}" }' |
| 104 | + ref: ${{ github.event.inputs.cli-branch }} |
| 105 | + inputs: '{ "changeLog": ${{ toJSON(needs.update-api-specs.outputs.change-log) }}, "version-Type": "${{needs.update-api-specs.outputs.version-type}}" }' |
0 commit comments