Skip to content

Merge pull request #198 from JoviDeCroock/changeset-release/main #227

Merge pull request #198 from JoviDeCroock/changeset-release/main

Merge pull request #198 from JoviDeCroock/changeset-release/main #227

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
outputs:
has_changesets: ${{ steps.changesets.outputs.hasChangesets }}
should_publish: ${{ steps.publish-check.outputs.should_publish }}
permissions:
contents: write
issues: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
with:
version: 11.3.0
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
package-manager-cache: false
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Install npm
run: npm install -g npm@11.15.0
- name: Create Release Pull Request
id: changesets
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
with:
version: pnpm run version
commitMode: github-api
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for unpublished package versions
if: steps.changesets.outputs.hasChangesets == 'false'
id: publish-check
run: node .github/scripts/has-unpublished-packages.mjs
publish:
name: Publish
needs: release
if: needs.release.outputs.should_publish == 'true'
environment:
name: npm
url: https://www.npmjs.com/org/pracht
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
with:
version: 11.3.0
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
package-manager-cache: false
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Install npm
run: npm install -g npm@11.15.0
# No separate build step: stage-packages.mjs stages each package with
# `pnpm publish`, whose prepublishOnly hook builds it. Package types resolve
# from source via tsconfig `paths`, so per-package builds need no ordering.
# changesets/action skips `git config user.*` in github-api commit mode,
# and checkout uses persist-credentials: false, so no identity is set.
# stage-packages.mjs creates annotated tags (`git tag -m`), which require one.
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Publish packages
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
with:
publish: node .github/scripts/stage-packages.mjs
createGithubReleases: true
commitMode: github-api
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}