Skip to content

Handle Release Branch Push #42

Handle Release Branch Push

Handle Release Branch Push #42

name: Handle Release Branch Push
on:
push:
jobs:
verify:
name: Verify
runs-on: ubuntu-latest
strategy:
matrix:
script:
# - name: Typecheck
# command: test:types
- name: Lint
command: test:lint
- name: Unit tests
command: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- name: ${{ matrix.script.name }}
run: npm run ${{ matrix.script.command }}
publish:
name: Publish
needs:
- verify
if: contains(fromJson('["refs/heads/alpha", "refs/heads/beta", "refs/heads/main"]'), github.ref)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Project
uses: ./.github/actions/setup
- name: Build Project
run: npm run build
shell: bash
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: release
run: |
export NEXT_TAG_VERSION=$(npx semantic-release | tee /dev/tty | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/')
echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT
shell: bash
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.new_tag_version != '' }}
run: npm publish ./dist/*.tgz --tag ${{ (github.head_ref || github.ref_name) == 'main' && 'latest' || github.head_ref || github.ref_name }}
shell: bash