On push to release branch #3
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: On push to release branch | |
on: | |
push: | |
branches: [ release ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.release.outputs.release }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set release | |
id: semrel | |
uses: go-semantic-release/action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
allow-initial-development-versions: true | |
force-bump-patch-version: true | |
# For whatever reason, this silly tool won't let you do releases from branches | |
# other than the default branch unless you pass this flag, which doesn't seem | |
# to actually have anything to do with CI: | |
# https://github.com/go-semantic-release/semantic-release/blob/master/cmd/semantic-release/main.go#L173-L194 | |
# https://github.com/go-semantic-release/condition-github/blob/4c8af3fc516151423fff2f77eb08bf7082570676/pkg/condition/github.go#L42-L44 | |
custom-arguments: '--no-ci' | |
- name: Output release | |
id: release | |
run: echo "::set-output name=release::${{ steps.semrel.outputs.version }}" | |
publish_javascript: | |
# The type of runner that the job will run on | |
runs-on: macos-latest | |
env: | |
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }} | |
TEST_CACHE_NAME: js-redis-client-test-ci | |
needs: release | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Build all packages | |
run: | | |
npm ci | |
npm run build | |
- name: Publish package to npm | |
run: | | |
export VERSION="${{ needs.release.outputs.version }}" | |
echo "Publishing package with version $VERSION" | |
mv package.json package.json.ORIG | |
cat package.json.ORIG|jq ". += {\"version\": \"$VERSION\"}" > package.json | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_POC_PUBLISH_TOKEN }} | |