cicd: add releases for next
versions
#52
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 | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.10.0] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: If we're in next, check if pre.json exists | |
if: github.ref == 'refs/heads/next' | |
run: | | |
[ -f ./.changeset/pre.json ] || { echo "Error: pre.json does not exist but needed for 'next' release" >&2; exit 1; } | |
- name: If we're in main, make sure pre.json isn't there | |
if: github.ref == 'refs/heads/main' | |
run: | | |
[ ! -f ./.changesets/pre.json ] || { echo "Error: pre.json should not exist when releasing main" >&2; exit 1; } | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8.14.1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: pnpm run bootstrap | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: pnpm run version | |
publish: pnpm run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_OPTIONS: --max-old-space-size=4096 |