Files

88 lines
2.5 KiB
YAML

name: Release
on:
push:
branches: [main]
concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
permissions: {}
jobs:
npm:
name: Publish to NPM
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6
with:
# Changesets needs full history to compute the changelog.
fetch-depth: 0
- uses: voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # ratchet:voidzero-dev/setup-vp@v1
with:
node-version: 24
cache: true
# TODO: we need to build the entire repo here just so that typechecking
# passes in the next step; otherwise, the web app is missing the built
# content-collections files and hard-fails on apps/web/src/lib/source.ts.
- name: Build
run: vp run build
- name: Lint
run: vp check
- name: Tests
run: vp test
- name: Create release PR or publish
id: changesets
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # ratchet:changesets/action@v1
with:
version: vp run version
publish: vp run release
title: "chore: release"
commit: "chore: release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
registry:
name: Compile & upload registry
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6
with:
fetch-depth: 0
- name: Detect registry changes
id: changes
env:
BEFORE: ${{ github.event.before }}
run: |
if git diff --name-only "$BEFORE" "$GITHUB_SHA" | grep -qE '^(registry/modules/|packages/schema/|scripts/)'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- uses: voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # ratchet:voidzero-dev/setup-vp@v1
if: steps.changes.outputs.changed == 'true'
with:
node-version: 24
cache: true
- name: Publish registry + schema to Blob
if: steps.changes.outputs.changed == 'true'
run: vp exec jiti scripts/publish-registry.ts
env:
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}