Skip to content

Release Full

Release Full #13

Workflow file for this run

name: Release Full
on:
workflow_dispatch:
inputs:
version:
type: choice
description: "Release Version Type"
required: true
default: "patch"
options:
- major
- premajor
- minor
- preminor
- patch
- prepatch
- prerelease
tag:
type: choice
description: "Release Npm Tag"
required: true
default: "latest"
options:
- canary
- nightly
- latest
- beta
- alpha
dry_run:
type: boolean
description: "DryRun release"
required: true
default: false
permissions:
# To publish packages with provenance
id-token: write
jobs:
release:
name: Release
environment: npm
permissions:
contents: write
# To publish packages with provenance
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Pnpm
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install Dependencies
run: pnpm install
- name: Run Test
run: pnpm run test
- name: Obtain OIDC token
id: oidc
run: |
token=$(curl --fail -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=cfa.rspack.dev" | jq -r '.value')
echo "::add-mask::${token}"
echo "token=${token}" >> $GITHUB_OUTPUT
shell: bash
- name: Obtain GitHub credentials
id: github_creds
run: |
token=$(curl --fail "https://cfa.rspack.dev/api/request/${{ secrets.CFA_PROJECT_ID }}/github/credentials" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer ${{ secrets.CFA_SECRET }}" \
--data "{\"token\":\"${{ steps.oidc.outputs.token }}\"}" | jq -r '.GITHUB_TOKEN')
echo "::add-mask::${token}"
echo "token=${token}" >> $GITHUB_OUTPUT
shell: bash
- name: Try release to npm
run: pnpm run release
env:
DRY_RUN: ${{ inputs.dry_run }}
TAG: ${{ inputs.tag }}
VERSION: ${{ inputs.version }}
GITHUB_TOKEN: ${{ steps.github_creds.outputs.token }}
GITHUB_OIDC_TOKEN: ${{ steps.oidc.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}