From 705e9eff9f6dad420437151fe9b50b92b57912ee Mon Sep 17 00:00:00 2001 From: Forbes Lindesay Date: Tue, 10 Mar 2026 14:35:50 +0000 Subject: [PATCH 1/2] ci: publish via GitHub actions instead of CircleCI --- .circleci/config.yml | 56 +------------------- .github/workflows-src/rollingversions.ts | 45 ++++++++++++++++ .github/workflows/rollingversions.yml | 65 ++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 54 deletions(-) create mode 100644 .github/workflows-src/rollingversions.ts create mode 100644 .github/workflows/rollingversions.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index f32026a4..38496f62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,64 +62,12 @@ jobs: - *build - *test - master: - <<: *container - steps: - - checkout - - *restore_cache - - *npm_auth - - *yarn_install - - *save_cache - - *prettier - - *build - - *test - - run: - name: Release - command: npx rollingversions publish --canary $CIRCLE_BUILD_NUM - - publish: - <<: *container - steps: - - checkout - - *restore_cache - - *npm_auth - - *yarn_install - - *build - - run: - name: Release - command: npx rollingversions publish - workflows: version: 2 all: jobs: - - all: - filters: - branches: - ignore: - - master - master: - jobs: - - master: - context: common-env - filters: - branches: - only: master - - - publish-approval: - type: approval - context: common-env - requires: - - master - - - publish: - context: common-env - filters: - branches: - only: master - requires: - - publish-approval - + - all + nightly: triggers: - schedule: diff --git a/.github/workflows-src/rollingversions.ts b/.github/workflows-src/rollingversions.ts new file mode 100644 index 00000000..47e3c5d3 --- /dev/null +++ b/.github/workflows-src/rollingversions.ts @@ -0,0 +1,45 @@ +import createWorkflow from 'github-actions-workflow-builder'; +import {secrets} from 'github-actions-workflow-builder/context'; +import {setup} from './test'; + +export default createWorkflow( + ({setWorkflowName, addTrigger, addJob, setPermissions, whenTrigger}) => { + setWorkflowName('Release'); + + addTrigger('repository_dispatch', { + types: ['rollingversions_publish_approved'], + }); + addTrigger('push'); // , {branches: ['master']}); + + setPermissions({ + 'id-token': 'write', // Required for OIDC to publish to NPM + contents: 'write', // To create GitHub releases + }); + + whenTrigger('push', () => { + addJob('publish_canary', ({add, run}) => { + add(setup()); + run('yarn build'); + run( + 'npx rollingversions publish --canary $GITHUB_RUN_NUMBER --allow-any-branch', + { + env: { + GITHUB_TOKEN: secrets.GITHUB_TOKEN, + }, + }, + ); + }); + }); + whenTrigger('repository_dispatch', () => { + addJob('publish', ({add, run}) => { + add(setup()); + run('yarn build'); + run('npx rollingversions publish', { + env: { + GITHUB_TOKEN: secrets.GITHUB_TOKEN, + }, + }); + }); + }); + }, +); diff --git a/.github/workflows/rollingversions.yml b/.github/workflows/rollingversions.yml new file mode 100644 index 00000000..bb929943 --- /dev/null +++ b/.github/workflows/rollingversions.yml @@ -0,0 +1,65 @@ +# !!! This file is auto-generated, do not edit by hand !!! +# To make changes, edit .github/workflows-src/rollingversions.ts and then run: +# +# github-actions-workflow-builder --directory ".github/workflows-src" + +name: Release +on: + repository_dispatch: + types: + - rollingversions_publish_approved + push: null +jobs: + publish_canary: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 24.x + registry-url: https://registry.npmjs.org + - name: Get yarn cache directory path + run: echo "::set-output name=dir::$(yarn cache dir)" + id: step_3 + - name: Enable Cache + uses: actions/cache@v4 + with: + path: |- + ${{ steps.step_3.outputs.dir }} + node_modules + packages/*/node_modules + key: ${{ runner.os }}-24.x-${{ hashFiles('yarn.lock') }}-2 + - run: yarn install --prefer-offline + - run: yarn build + - run: npx rollingversions publish --canary $GITHUB_RUN_NUMBER --allow-any-branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'repository_dispatch' }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 24.x + registry-url: https://registry.npmjs.org + - name: Get yarn cache directory path + run: echo "::set-output name=dir::$(yarn cache dir)" + id: step_3 + - name: Enable Cache + uses: actions/cache@v4 + with: + path: |- + ${{ steps.step_3.outputs.dir }} + node_modules + packages/*/node_modules + key: ${{ runner.os }}-24.x-${{ hashFiles('yarn.lock') }}-2 + - run: yarn install --prefer-offline + - run: yarn build + - run: npx rollingversions publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +permissions: + id-token: write + contents: write From 8ffc78a7b428a775669f5d59a9c5f56902d60359 Mon Sep 17 00:00:00 2001 From: Forbes Lindesay Date: Tue, 10 Mar 2026 14:40:27 +0000 Subject: [PATCH 2/2] feat: only publish canary from master branch --- .github/workflows-src/rollingversions.ts | 2 +- .github/workflows/rollingversions.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows-src/rollingversions.ts b/.github/workflows-src/rollingversions.ts index 47e3c5d3..e665d292 100644 --- a/.github/workflows-src/rollingversions.ts +++ b/.github/workflows-src/rollingversions.ts @@ -9,7 +9,7 @@ export default createWorkflow( addTrigger('repository_dispatch', { types: ['rollingversions_publish_approved'], }); - addTrigger('push'); // , {branches: ['master']}); + addTrigger('push', {branches: ['master']}); setPermissions({ 'id-token': 'write', // Required for OIDC to publish to NPM diff --git a/.github/workflows/rollingversions.yml b/.github/workflows/rollingversions.yml index bb929943..e0906c55 100644 --- a/.github/workflows/rollingversions.yml +++ b/.github/workflows/rollingversions.yml @@ -8,7 +8,9 @@ on: repository_dispatch: types: - rollingversions_publish_approved - push: null + push: + branches: + - master jobs: publish_canary: runs-on: ubuntu-latest