Skip to content

Cli Release

Cli Release #90

Workflow file for this run

name: Cli Release
on:
workflow_dispatch:
inputs:
change-log:
description: 'Open API Changelog.'
version-type:
description: 'Version to upgrade, Major: 0, Minor:1, Patch: 2'
homebrew-branch:
description: 'HomeBrew branch name'
default: main
homebrew-prerelease:
description: 'HomeBrew prerelease'
default: 'false'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 16.x, 14.x]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: make install
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Run tests
run: npm test
update-api-definitions-changelog:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout cli
uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Update Changelog
run: |
bash .github/scripts/commit-api-spec-change-log.sh "${{ github.event.inputs.change-log }}" ${{ github.event.inputs.version-type }}
release:
runs-on: ubuntu-latest
needs: [update-api-definitions-changelog]
outputs:
tag-name: ${{ steps.semantic-release.outputs.TAG_NAME }}
draft-tag-name: ${{ steps.semantic-release-draft.outputs.TAG_NAME }}
steps:
- name: Checkout cli
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Run git and npm update
run: |
git pull
make install
- name: Semantic Release runs
id: semantic-release
run: DEBUG=semantic-release:* npx semantic-release -t \${version}
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- 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
run: node .github/scripts/update-release.js
env:
TAG_NAME: ${{steps.semantic-release.outputs.TAG_NAME}}
RELEASE_BODY: ${{github.event.inputs.change-log}}
REPO_NAME: ${{ github.repository }}
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]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: |
git pull
make install
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke Oclif workflow
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch == 'main'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'oclif-release.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
INPUTS: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
- name: Invoke Oclif workflow for release candidate
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch != 'main'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'oclif-release.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
INPUTS: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "formula": "twiliorc", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
docker-release:
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: |
git pull
make install
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke Docker workflow
if: ${{needs.release.outputs.tag-name != ''}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'docker-release.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
- name: Run acceptance testing for docker release
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: '.github/workflows/cli-test-docker.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
platform-executables-release:
runs-on: ubuntu-latest
needs: [ release ]
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
- run: |
git pull
make install
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- 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: ${{ matrix.executable_workflow }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
notify-complete-fail:
if: ${{ failure() || cancelled() }}
needs: [ release, oclif-release, platform-executables-release ]
name: Notify Release Failed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }}
SLACK_COLOR: "#ff3333"
SLACK_USERNAME: CLI Release Bot
SLACK_ICON_EMOJI: ":ship:"
SLACK_TITLE: "Twilio Cli"
SLACK_MESSAGE: 'CLI Release workflow Failed'