v9.0.2 #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release | |
on: | |
release: | |
types: [published] | |
permissions: | |
# we use a personal access token to push the release branch | |
id-token: write # required for provenance/signed releases on npm | |
jobs: | |
publish: | |
name: Publish Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 # we want to push the release branch later | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
- name: Set node version to 22 | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 | |
with: | |
node-version: 22 | |
cache: 'pnpm' | |
- name: Install deps | |
run: pnpm install --frozen-lockfile | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
- name: Gather release information | |
run: | | |
RELEASE_VERSION=$(jq -r '.version' package.json) | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
RELEASE_MAJOR=$(jq -r '.version | split(".")[0]' package.json) | |
echo "RELEASE_MAJOR=$RELEASE_MAJOR" >> $GITHUB_ENV | |
DIST_TAG=$(jq -r '.version | if split("-")[1] == null then "latest" else "next" end' package.json) | |
echo "DIST_TAG=$DIST_TAG" >> $GITHUB_ENV | |
- name: Prepare README | |
run: | | |
echo -e "$(grep -P '## 📙 API Documentation' -B 10000 README.md)\n\n- [Getting Started Guide](https://fakerjs.dev/guide/)\n- [API Reference](https://fakerjs.dev/api/)\n\n$(grep -P '## 🚀 Features' -A 10000 README.md)" > README.md | |
sed -i "s|/fakerjs.dev/|/v$RELEASE_MAJOR.fakerjs.dev/|g" README.md | |
- name: Set publishing config | |
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}" | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Publish | |
run: | | |
pnpm publish --tag next --no-git-checks | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
NPM_CONFIG_PROVENANCE: true | |
- name: Set latest/next dist-tag | |
run: | | |
pnpm dist-tag add @faker-js/faker@$RELEASE_VERSION $DIST_TAG | |
- name: Push to Release Branch | |
run: | | |
git push origin $GITHUB_REF_NAME:v$RELEASE_MAJOR |