Oclif Release #99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Oclif Release | |
on: | |
workflow_dispatch: | |
inputs: | |
home-brew-branch: | |
description: 'Run workflow in home brew branch' | |
default: main | |
tag-name: | |
description: 'Tag to be released in Homebrew (Same as CLI latest tag name)' | |
required: true | |
formula: | |
description: 'Formula to release in homebrew' | |
default: twilio | |
pre-release: | |
description: 'Homebrew release type' | |
default: 'false' | |
jobs: | |
oclif-release: | |
name: Publish for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
outputs: | |
sha256: ${{ steps.sha256.outputs.sha256 }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-latest | |
asset_name: twilio-v${{ github.event.inputs.tag-name }} | |
command_name: npx oclif-dev pack --xz -t darwin-arm64,darwin-x64,linux-arm,linux-x64,win32-x64,win32-x86 | |
publish: homebrew | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
make install | |
npm list @twilio/cli-core | |
if [ "$RUNNER_OS" == "macOS" ]; then | |
brew install makensis | |
fi | |
${{ matrix.command_name }} | |
- name: Configure AWS credentials from Test account | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} | |
aws-region: us-east-1 | |
- name: Publish assests to s3 and calculate sha of oclif dev pack | |
id: sha256 | |
if: ${{matrix.publish == 'homebrew'}} | |
run: | | |
make clean | |
make install | |
npx oclif-dev publish | |
brew install coreutils | |
if [ "${{github.event.inputs.formula}}" == "twiliorc" ]; then | |
echo "::set-output name=sha256::$(sha256sum dist/channels/rc/${{ matrix.asset_name }}/${{ matrix.asset_name }}.tar.gz | awk '{print $1}')" | |
elif [ "${{github.event.inputs.formula}}" == "twiliodraft" ]; then | |
echo "::set-output name=sha256::$(sha256sum dist/channels/draft/${{ matrix.asset_name }}/${{ matrix.asset_name }}.tar.gz | awk '{print $1}')" | |
else | |
echo "::set-output name=sha256::$(sha256sum dist/${{ matrix.asset_name }}/${{ matrix.asset_name }}.tar.gz | awk '{print $1}')" | |
fi | |
home-brew-release: | |
name: Trigger homebrew release workflow | |
runs-on: ubuntu-latest | |
needs: [oclif-release] | |
steps: | |
- name: Checkout cli repo | |
uses: actions/checkout@v2 | |
- name: Invoke HomeBrew workflow | |
run: source .github/scripts/trigger-and-wait.sh | |
env: | |
INPUT_OWNER: ${{ github.repository_owner }} | |
INPUT_REPO: homebrew-brew | |
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
INPUT_WORKFLOW_FILE_NAME: release.yml | |
INPUT_REF: ${{ github.event.inputs.home-brew-branch }} | |
INPUT_WAITING_INTERVAL: 10 | |
INPUT_INPUTS: '{ "formula": "${{github.event.inputs.formula}}", "version": "${{github.event.inputs.tag-name}}", "sha": "${{needs.oclif-release.outputs.sha256}}", "pre-release": "${{github.event.inputs.pre-release}}" }' | |
INPUT_PROPAGATE_FAILURE: true | |
scoop-release: | |
name: Trigger scoop release workflow | |
runs-on: ubuntu-latest | |
needs: [ oclif-release ] | |
steps: | |
- name: Checkout cli repo | |
uses: actions/checkout@v2 | |
- name: Extract branch name | |
id: extract_branch | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
- name: Invoke Scoop workflow | |
if: ${{steps.extract_branch.outputs.branch == 'main'}} | |
run: source .github/scripts/trigger-and-wait.sh | |
env: | |
INPUT_OWNER: ${{ github.repository_owner }} | |
INPUT_REPO: scoop-twilio-cli | |
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
INPUT_WORKFLOW_FILE_NAME: update-release.yml | |
INPUT_WAITING_INTERVAL: 10 | |
INPUT_INPUTS: '{ "version": "${{github.event.inputs.tag-name}}" }' | |
INPUT_PROPAGATE_FAILURE: true | |
notify-complete-fail: | |
if: ${{ failure() || cancelled() }} | |
needs: [ home-brew-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: 'Oclif Release Workflow Failed' | |
MSG_MINIMAL: actions url |