diff --git a/.github/workflows/apt-release.yml b/.github/workflows/apt-release.yml index f1f5c117b..716c1498c 100644 --- a/.github/workflows/apt-release.yml +++ b/.github/workflows/apt-release.yml @@ -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: diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 0f31893ba..25770c7c6 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -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 @@ -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 @@ -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 ] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c17bf063f..23cb59838 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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}} @@ -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] @@ -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 @@ -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 ] diff --git a/.github/workflows/rpmbuild.yml b/.github/workflows/rpmbuild.yml index a9d918208..8cc4f1d52 100644 --- a/.github/workflows/rpmbuild.yml +++ b/.github/workflows/rpmbuild.yml @@ -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: diff --git a/.github/workflows/windows-executable-release.yml b/.github/workflows/windows-executable-release.yml index 6cc5e0667..916c94246 100644 --- a/.github/workflows/windows-executable-release.yml +++ b/.github/workflows/windows-executable-release.yml @@ -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'