Release #50
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: | |
workflow_dispatch: | |
inputs: | |
post-publish-only: | |
type: boolean | |
description: "Run post-publish script without publishing" | |
default: false | |
# copy-pasted from ci.yml | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: quantified-uncertainty | |
# used by turbo cache hashes, see turbo.json | |
PLATFORM: github | |
# not needed while we don't run this workflow automatically | |
# concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- name: Setup Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build changelog script | |
working-directory: packages/ops | |
run: pnpm turbo build | |
# if there are existing changesets, PR will be created. | |
# Otherwise, `publish` command will be invoked. | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
if: inputs.post-publish-only != true | |
uses: changesets/action@v1 | |
with: | |
title: New release | |
version: pnpm run changeset-version | |
publish: pnpm run publish-all | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- name: Extract published version | |
id: published-version | |
run: | | |
VERSION=$(cat packages/squiggle-lang/package.json | fgrep '"version"' | head -1 | perl -ne '/"version": "([^"]+)"/ && print $1') | |
echo "published-version=$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Prepare for next release | |
if: steps.changesets.outputs.published == 'true' || inputs.post-publish-only | |
run: pnpm run post-publish | |
- name: Create PR with version patches | |
if: steps.changesets.outputs.published == 'true' || inputs.post-publish-only | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: Bump versions after ${{ steps.published-version.outputs.published-version }} release | |
title: Bump versions after ${{ steps.published-version.outputs.published-version }} release |