diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000..5289d9e --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,51 @@ +name: Snapshot release +run-name: Snapshot release by ${{ github.actor }} + +on: + issue_comment: + types: [created] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }} + cancel-in-progress: true + +jobs: + snapshot-release: + if: ${{ startsWith(github.event.comment.body, '!snapshot') && github.repository == 'clerk/javascript' && github.event.issue.pull_request }} + runs-on: ubuntu-latest + timeout-minutes: ${{ vars.TIMEOUT_MINUTES_NORMAL && fromJSON(vars.TIMEOUT_MINUTES_NORMAL) || 10 }} + + permissions: + contents: read + id-token: write + + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: 'npm' + + - name: Checkout repo + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.issue.number }}/head + + - name: Install NPM Dependencies + run: npm ci --audit=false --fund=false --prefer-offline + shell: bash + + - name: Version packages for snapshot + id: version-packages + run: npm run version:snapshot | tail -1 >> "$GITHUB_OUTPUT" + + - name: Build astro-clerk-auth + if: steps.version-packages.outputs.success == '1' + timeout-minutes: 5 + run: npx turbo build --filter='astro-clerk-auth' + + - name: Snapshot release + if: steps.version-packages.outputs.success == '1' + run: npm run release:snapshot + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true \ No newline at end of file diff --git a/package.json b/package.json index 3dc82db..c4ad28f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "changeset": "changeset", - "release": "changeset publish && git push --follow-tags" + "release": "changeset publish && git push --follow-tags", + "version:snapshot": "changeset version --snapshot", + "release:snapshot": "changeset publish --tag snapshot --no-git-tag" }, "devDependencies": { "eslint-config-custom": "*",