Skip to content

πŸš€ Release + Publish #19

πŸš€ Release + Publish

πŸš€ Release + Publish #19

Workflow file for this run

name: πŸš€ Release + Publish
on:
workflow_dispatch:
inputs:
versionChange:
type: choice
description: Select the version change
required: true
default: 'minor'
options:
- major
- minor
- patch
jobs:
release:
runs-on: ubuntu-latest
env:
VERSION_CHANGE: ${{ github.event.inputs.versionChange }}
permissions:
contents: write
id-token: write
steps:
- name: βœ… Use App Token for the Bot which is allowed to create releases
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: πŸ›ŽοΈ Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: πŸ›  Setup Platform
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version
- name: πŸ“¦ Install dependencies
run: |
bun install --frozen-lockfile
bun add -g npm
- name: β†— Update version
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git config --global push.followTags true
npm version ${{ env.VERSION_CHANGE }} -m "Release %s"
- name: πŸ” Get meta data
run: |
VERSION=$(bun --print "(await import('./package.json')).version")
NAME=$(bun --print "(await import('./package.json')).name")
DISPLAY_NAME=$(bun --print "(await import('./package.json')).displayName")
echo VERSION=$VERSION >> $GITHUB_ENV
echo NAME=$NAME >> $GITHUB_ENV
echo DISPLAY_NAME=$DISPLAY_NAME >> $GITHUB_ENV
- name: βš’οΈ Build
run: bun run build
- name: πŸ“Œ Push tags
run: git push
- name: πŸ”† Release ${{ env.VERSION }}
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }}
generate_release_notes: true
- name: 🌐 Publish to NPM Registry
run: |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
npm publish --provenance --access public