Skip to content

Commit

Permalink
feat: Added github actions for publish to s3 and trigger homebrew rel…
Browse files Browse the repository at this point in the history
…ease (#287)

* feat: Added github actions for publish to s3 and trigger homebrew release

* Fixing indentation issue

* Added change to publish to npm.
Added missing repo name

* Added trigger to oclif-release workflow in cli.
Addressed the review comments.

* Added npm token in semantic release

* Added release_feature_branch in the prerelease.

Co-authored-by: lakshmiravali <lakshmiravali.rimmalapudi@gmail.com>
  • Loading branch information
ravali-rimmalapudi and lakshmiravalir authored Sep 14, 2021
1 parent ce15661 commit 5d7acd6
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 9 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/oclif-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Oclif Release
on:
workflow_dispatch:
inputs:
home-brew-branch:
description: 'Run workflow in home brew branch'
default: main
tag-name:
description: 'Tag released recently'
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: ${{ github.event.inputs.formula }}-v${{ github.event.inputs.tag-name }}
command_name: npx oclif-dev pack
publish: homebrew
steps:
- uses: actions/checkout@v2
- run: |
npm install
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-region: us-east-1
- name: Publish assests to s3 and calculate sha of oclif dev pack
id: sha256
if: ${{matrix.publish == 'homebrew'}}
run: |
npx oclif-dev publish
brew install coreutils
echo "::set-output name=sha256::$(sha256sum dist/${{ matrix.asset_name }}/${{ matrix.asset_name }}.tar.gz | awk '{print $1}')"
home-brew-release:
name: Trigger homebrew release workflow
runs-on: ubuntu-latest
needs: [oclif-release]
steps:
- name: Invoke HomeBrew workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Homebrew Release
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repo: twilio/homebrew-brew
ref: ${{ github.event.inputs.home-brew-branch }}
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}}" }'
22 changes: 20 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ on:
version-type:
description: 'Version to upgrade, Major: 0, Minor:1, Patch: 2'
required: true
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: [14.x]
node-version: [14.x, 10.x]
steps:
- name: Checkout cli-core repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -52,6 +58,7 @@ jobs:
run: npx semantic-release -t \${version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
update-release:
runs-on: ubuntu-latest
needs: [ release ]
Expand All @@ -67,7 +74,6 @@ jobs:
with:
is_append_body: true
body: ${{ github.event.inputs.change-log }}

deploy-docker:
runs-on: ubuntu-latest
needs: [ release ]
Expand Down Expand Up @@ -100,3 +106,15 @@ jobs:
- name: Image digest
run: |
echo ${{ steps.docker_build.outputs.digest }}
oclif-release:
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Invoke CLI workflow with changelog and version-type
if: ${{needs.release.outputs.tag-name != ''}}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Oclif Release
repo: twilio/twilio-cli
token: ${{ secrets.REPO_ACCESS_TOKEN }}
inputs: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
9 changes: 2 additions & 7 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"branches": [
"main",
{
"name": "github_action_changes",
"name": "release_feature_branch",
"prerelease": "rc"
}
],
Expand Down Expand Up @@ -52,12 +52,7 @@
"changelogFile": "CHANGES.md"
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/git",
Expand Down

0 comments on commit 5d7acd6

Please sign in to comment.