Skip to content

fix(core): upgrade serve handler min version to for upgrade users to … #6

fix(core): upgrade serve handler min version to for upgrade users to …

fix(core): upgrade serve handler min version to for upgrade users to … #6

Workflow file for this run

name: Publish
on:
# Publish canary on push
push:
branches:
- main
- docusaurus-v**
paths:
- .github/workflows/publish.yml
- package.json
- packages/**
# Publish release on manual dispatch
workflow_dispatch:
inputs:
npm_version:
description: 'NPM Version - Including prerelease suffix (optional)'
required: true
default: 3.0.0-alpha.0
npm_tag:
type: choice
description: 'NPM Dist Tag - Use `latest` for official stable releases'
# default: canary
required: true
options:
- canary
- alpha
- beta
- rc
- latest
permissions:
id-token: write # For OIDC, see https://docs.npmjs.com/trusted-publishers
contents: write # For GitHub tags
jobs:
publish:
name: Publish NPM release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
- name: Set up Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/*
# ⚠️ Do not use any cache on purpose
# It increases the chance of a compromised release being publish
# See https://github.com/actions/setup-node/issues/1445#issuecomment-4040130833
# cache: yarn
- name: Prepare git
run: |
git config --global user.name "Docusaurus"
git config --global user.email "github@docusaurus.io"
- name: Installation
run: yarn || yarn || yarn
# TODO Docusaurus v4: remove after we upgrade the Node version
- name: Upgrade Lerna
run: |
yarn add -D -W lerna@9.0.3 --ignore-scripts
git restore .
- name: Publish Canary release
if: |
github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.npm_tag == 'canary')
run: |
yarn canary:bumpVersion
yarn canary:publish
- name: Publish NPM release
if: |
github.event_name == 'workflow_dispatch' && github.event.inputs.npm_tag != 'canary'
run: |
yarn lerna publish \
--force-publish \
--exact "${{ github.event.inputs.npm_version }}" \
--dist-tag "${{ github.event.inputs.npm_tag }}" \
--loglevel verbose \
--yes \
--no-verify-access \
--no-push
git push origin v"${{ github.event.inputs.npm_version }}"
# TODO Docusaurus v4: upgrade Lerna, remove useless --no-verify-access everywhere
# TODO should we push the package version local updates to Git?
# "main" is currently protected, even GitHub Actions can't push to it
# However it remains useful to push the git tag