fix(ci): semantic-release workflow for v9 releases (#1082) #291
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
- next | |
- v9 | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
# See provenance docs: https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | |
id-token: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.RELEASE_GH_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies and build TS | |
run: npm ci && npm run build | |
- name: Install semantic-release and friends | |
run: npm i --no-save semantic-release@24 @semantic-release/changelog@6 @semantic-release/exec@6 @semantic-release/git@10 | |
- name: Run semantic-release workflow | |
env: | |
GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# See provenance docs: https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | |
NPM_CONFIG_PROVENANCE: 'true' | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release | |
- name: Sync changes back to next | |
if: ${{ github.ref }} == 'refs/heads/main' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.RELEASE_GH_TOKEN }} | |
branch: next | |
# quick assertion to validate that rdme CLI can be installed and run on ubuntu | |
postrelease: | |
name: Post-release checks | |
needs: release | |
runs-on: ubuntu-latest | |
if: ${{ github.ref }} == 'refs/heads/next' | |
steps: | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install `rdme` from npm | |
run: npm install -g rdme@next | |
- name: Print rdme CLI version | |
run: rdme --version | |
timeout-minutes: 1 |