Skip to content

🚀 Release

🚀 Release #9

Workflow file for this run

name: "🚀 Release"
on:
workflow_dispatch:
inputs:
firstRelease:
description: "Is this the first release?"
required: true
type: boolean
default: false
website:
description: "Publish website?"
required: true
type: boolean
default: true
workflow_call:
inputs:
firstRelease:
description: "Is this the first release?"
type: boolean
default: false
website:
description: "Publish website?"
required: true
type: boolean
default: true
concurrency: "release"
env:
NX: node_modules/.bin/nx
jobs:
build:
uses: ./.github/workflows/build.yml
release:
runs-on: ubuntu-latest
needs: [ build ]
permissions:
contents: write
id-token: write
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "🔧 Setup node"
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
registry-url: 'https://npm.pkg.github.com/'
- name: "📜 SHAs for Nx affected"
uses: nrwl/nx-set-shas@v4
- name: "📦 Install dependencies"
uses: ./.github/actions/install
- name: "🔍 Environment Info"
run: npx nx report
- name: "🔧 Configure git"
run: |
git config --local user.name "${{ github.actor }}"
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
- name: "🚀 Update package.json files, commit changes then tag via GitHub Release"
run: |
${{ env.NX }} release --skip-publish ${{ github.event.inputs.firstRelease == 'true' && '--first-release' || '' }}
env:
GH_TOKEN: ${{ github.token }}
- name: "🔨 Build"
run: ${{ env.NX }} run-many -t build
- name: "📦 Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: "build"
path: dist
if-no-files-found: error
retention-days: 1
# We can't publish in the release job, because we changed the git user.
publish:
runs-on: ubuntu-latest
needs: [ release ]
permissions:
contents: write
id-token: write
packages: write
steps:
- name: "📥 Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "🔧 Setup node"
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
registry-url: 'https://npm.pkg.github.com/'
- name: "📜 SHAs for Nx affected"
uses: nrwl/nx-set-shas@v4
- name: "📦 Install dependencies"
uses: ./.github/actions/install
- name: "🔍 Environment Info"
run: npx nx report
- name: "📦 Download artifacts"
uses: actions/download-artifact@v4
with:
name: "build"
path: dist
- name: "🚀 Publish npm packages"
run: |
${{ env.NX }} release publish --yes ${{ github.event.inputs.firstRelease == 'true' && '--first-release' || '' }}
env:
GH_TOKEN: ${{ github.token }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: ${{ github.event.inputs.firstRelease == 'false' }}
website:
needs: [ release ]
if: ${{ github.event.inputs.website == 'true' }}
uses: ./.github/workflows/website.yml