Skip to content

Commit

Permalink
chore: fix workflow for duplicate release (twilio#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
kridai committed Aug 30, 2022
1 parent cf90baa commit 8bf9188
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 45 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/apt-release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Apt Release
on:
workflow_dispatch:
workflow_run:
# wait for Cli Release to complete, when it completes, start this workflow
workflows: ["Cli Release"]
branches: [main]
types:
- completed

jobs:
apt-build-release:
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
INPUTS: '{ "version": "${{ steps.semantic-release-draft.outputs.TAG_NAME }}" }'
- name: verify release required
if: ${{ steps.semantic-release-draft.outputs.TAG_NAME == ''}}
uses: actions/github-script@v3
with:
script: |
core.setFailed('There are no relevant changes, so no new version is released.')
- name: Update release
if: ${{steps.semantic-release-draft.outputs.TAG_NAME != ''}}
run: node .github/scripts/update-release.js
Expand Down Expand Up @@ -154,9 +160,12 @@ jobs:
platform-executables-release:
runs-on: ubuntu-latest
needs: [ release ]
env:
env:
REPO_NAME: twilio/twilio-cli
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
strategy:
matrix:
executable_workflow: [ 'debian-executable-release.yml', 'macos-executable-release.yml', 'rpmbuild.yml', 'windows-executable-release.yml', 'apt-release.yml' ]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
Expand All @@ -166,21 +175,14 @@ jobs:
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke debian executable workflow
- name: Invoke platform executable workflow
if: ${{needs.release.outputs.draft-tag-name != ''}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'debian-draft-executable-release.yml'
WORKFLOW_NAME: ${{ matrix.executable_workflow }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}

- name: Invoke macos package release workflow
if: ${{needs.release.outputs.draft-tag-name != ''}}
#TODO make changes to trigger-workflow script to accept multiple workflow names at once
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'macos-executable-release.yml'
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}



notify-complete-fail:
if: ${{ failure() || cancelled() }}
needs: [ release, oclif-release, platform-executables-release ]
Expand Down
29 changes: 14 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: verify release required
if: ${{steps.semantic-release.outputs.TAG_NAME == ''}}
uses: actions/github-script@v3
with:
script: |
core.setFailed('There are no relevant changes, so no new version is released.')
- name: Update release
if: ${{steps.semantic-release.outputs.TAG_NAME != ''}}
run: node .github/scripts/update-release.js
env:
TAG_NAME: ${{steps.semantic-release.outputs.TAG_NAME}}
Expand All @@ -74,6 +76,9 @@ jobs:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUTS: '{ "tag-name": "${{needs.release.outputs.draft-tag-name}}" }'
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
oclif-release:
runs-on: ubuntu-latest
needs: [release]
Expand Down Expand Up @@ -138,6 +143,9 @@ jobs:
env:
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
strategy:
matrix:
executable_workflow: ['debian-executable-release.yml', 'macos-executable-release.yml', 'rpmbuild.yml', 'windows-executable-release.yml', 'apt-release.yml']
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
Expand All @@ -147,22 +155,13 @@ jobs:
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke debian executable workflow
- name: Invoke platform executable workflow
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch == 'main'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'debian-executable-release.yml'
WORKFLOW_NAME: ${{ matrix.executable_workflow }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}

- name: Invoke macos package release workflow
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch == 'main'}}
#TODO make changes to trigger-workflow script to accept multiple workflow names at once
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'macos-executable-release.yml'
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}


notify-complete-fail:
if: ${{ failure() || cancelled() }}
needs: [ release, oclif-release, platform-executables-release ]
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/rpmbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: RPM Build

on:
workflow_dispatch:
workflow_run:
# wait for Cli Release to complete, when it completes, start this workflow
workflows: ["Cli Release"]
branches: [main]
types:
- completed
jobs:

rpmbuild:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/windows-executable-release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Windows Executable Release
on:
workflow_dispatch:
workflow_run:
# wait for Cli Release to complete, when it completes, start this workflow
workflows: ["Cli Release"]
branches: [main]
types:
- completed
env:
FORMULA_NAME: 'twilio'

Expand Down

0 comments on commit 8bf9188

Please sign in to comment.