Skip to content

πŸ‘·β€β™‚οΈ Build Release #167

πŸ‘·β€β™‚οΈ Build Release

πŸ‘·β€β™‚οΈ Build Release #167

Workflow file for this run

name: πŸ‘·β€β™‚οΈ Build Release
on:
workflow_run:
workflows: ["tests:unit"]
branches: [master]
types: [completed]
paths:
- 'packages/**'
jobs:
cli-release:
name: πŸ‘·β€β™‚οΈ Build Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
node-version: [ 22.12.0 ]
permissions:
contents: write
pull-requests: write
id-token: write
outputs:
BUILD_VERSION: ${{ steps.version.outputs.BUILD_VERSION }}
steps:
- name: πŸ“₯ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🟒 Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.10.0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 'latest'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install the packages
run: pnpm i
- name: πŸ— Build packages
run: pnpm run build
- name: πŸ” Setup npm auth
run: |
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: πŸ•΅οΈ Check for changes
id: version
run: |
# get latest commit sha
SHA=$(git rev-parse HEAD)
# get first 7 characters of sha
SHORT_SHA=${SHA::7}
BUILD_VERSION=build-${SHORT_SHA}
# set output so it can be used in other jobs
echo "BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_OUTPUT
- name: πŸš€ Publish build release
run: node ./release.js --prod --snapshot ${{ steps.version.outputs.BUILD_VERSION }}