Skip to content

chore(release): v1.3.4-beta.5 #58

chore(release): v1.3.4-beta.5

chore(release): v1.3.4-beta.5 #58

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
use-npm:
description: Should npm packages be published?
type: boolean
default: true
use-homebrew:
description: Should the Homebrew tap be updated?
type: boolean
default: true
version:
description: The release version (e.g., v1.2.3)
required: false
permissions:
contents: write
env:
NOTO_VERSION: ${{ inputs.version || github.ref_name }}
jobs:
npm:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || inputs.use-npm == true }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"
- run: bun install
working-directory: packages/cli
- name: Build
working-directory: packages/cli
run: bun run build
- name: Determine npm tag
id: determine_npm_tag
shell: bash
run: |
if [[ "${{ env.NOTO_VERSION }}" =~ -(next|canary|beta|rc) ]]; then
NPM_TAG=${BASH_REMATCH[1]}
else
git fetch origin main
if git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
NPM_TAG="latest"
else
echo "The tagged commit is not on the main branch."
echo "::error ::Releases with the 'latest' npm tag must be on the main branch."
exit 1
fi
fi
echo "npm_tag=$NPM_TAG" >> $GITHUB_OUTPUT
echo "Using npm tag: $NPM_TAG"
- name: Publish to npm
working-directory: packages/cli
run: bun publish --provenance --access public --tag ${{ steps.determine_npm_tag.outputs.npm_tag }}
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
homebrew:
runs-on: ubuntu-latest
needs: npm
if: >
always() &&
(needs.npm.result == 'success' || needs.npm.result == 'skipped') &&
(
github.event_name == 'push' ||
inputs.use-homebrew == true
) &&
!contains(github.ref, 'next') &&
!contains(github.ref, 'canary') &&
!contains(github.ref, 'beta') &&
!contains(github.ref, 'rc')
steps:
- name: Wait for npm package availability
if: needs.npm.result == 'success'
run: |
PACKAGE_NAME="@snelusha/noto"
VERSION="${{ env.NOTO_VERSION }}"
MAX_ATTEMPTS=30
SLEEP_TIME=10
echo "Waiting for $PACKAGE_NAME@$VERSION to be available on npm..."
for i in $(seq 1 $MAX_ATTEMPTS); do
echo "Attempt $i/$MAX_ATTEMPTS..."
if npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null; then
echo "Package is available!"
exit 0
fi
if [ $i -lt $MAX_ATTEMPTS ]; then
echo "Package not yet available, waiting ${SLEEP_TIME}s..."
sleep $SLEEP_TIME
fi
done
echo "Package did not become available after $((MAX_ATTEMPTS * SLEEP_TIME)) seconds"
exit 1
- name: Checkout homebrew-noto
uses: actions/checkout@v4
with:
repository: snelusha/homebrew-noto
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- name: Setup GPG
id: gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
- name: Update Tap
run: ruby scripts/release.rb "${{ env.NOTO_VERSION }}"
- name: Commit Tap
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_options: --gpg-sign=${{ steps.gpg.outputs.keyid }}
commit_message: "chore: release ${{ env.NOTO_VERSION }}"
commit_user_name: "snelusha"
commit_user_email: "hello@snelusha.dev"
commit_author: "Sithija Nelusha Silva <hello@snelusha.dev>"