name: npm promote
on:
schedule:
- cron: "*/10 * * * *"
workflow_run:
workflows: [Release]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
dry-run:
description: Print what would change without moving dist-tags or touching issues
type: boolean
default: false
# Promotions never overlap. A running promotion is never cancelled; a newer
# queued run replaces an older queued one, which is safe because every run
# re-reads the registry.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions: {}
jobs:
promote:
name: Promote
# NPM_PROMOTE_PAUSED is the kill switch for a bad release still on `staging`.
if: >-
github.repository_owner == 'Effect-Ts'
&& github.ref == 'refs/heads/main'
&& vars.NPM_PROMOTE_PAUSED != 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
# The npm trusted publisher configuration for dist-tags pins this
# workflow file and environment.
environment: npm-promote
permissions:
contents: read
# Records website deploys, so a failed or interrupted deploy is retried.
deployments: write
# npm trusted publishing: dist-tag writes authenticate over OIDC.
id-token: write
issues: write
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: main
# The overdue check reads the commit that bumped the version.
fetch-depth: 0
persist-credentials: false
- name: Install dependencies
uses: ./.github/actions/setup
- name: Upgrade npm for OIDC dist-tag support
run: npm install -g npm@^11.21.0
# Promotes the release, deploys the website for it and keeps the tracking issue up to date.
- name: Promote staged release
env:
DRY_RUN: ${{ inputs.dry-run }}
GITHUB_TOKEN: ${{ github.token }}
WEBSITE_DISPATCH_TOKEN: ${{ secrets.WEBSITE_DISPATCH_TOKEN }}
run: |
args=()
if [[ "$DRY_RUN" == "true" ]]; then
args+=(--dry-run)
fi
node packages/tools/npm-promote/src/bin.ts "${args[@]}"