docs: change wording to remove confusion #33
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: release | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
force_github_package_release: | |
description: Force GPM release | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
install-deps: | |
name: 📦 Install dependencies | |
if: github.repository == 'lukemorales/next-safe-navigation' && github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🔑 Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🔧 Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: ♻️ Cache node_modules | |
uses: actions/cache@v4 | |
id: bun-cache | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
if: steps.bun-cache.outputs.cache-hit != 'true' | |
- run: bun install --frozen-lockfile | |
build: | |
name: 🏗️ Build package | |
runs-on: ubuntu-latest | |
needs: install-deps | |
steps: | |
- name: 🔑 Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🔧 Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: 📦 Install dependencies | |
if: steps.bun-cache.outputs.cache-hit != 'true' | |
run: bun install --frozen-lockfile | |
- name: 🚨 Check for errors | |
run: bun run lint | |
- name: 🧪 Run tests | |
run: bun run test:ci | |
- name: ⚒️ Build package | |
run: bun run build | |
release: | |
name: 🚀 Release to NPM | |
if: github.event.inputs.force_github_package_release != 'true' | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
steps: | |
- name: 🔑 Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 🔧 Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: ♻️ Load node_modules | |
uses: actions/cache@v4 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/bun.lockb') }} | |
- name: ♻️ Load build files | |
uses: actions/cache@v4 | |
with: | |
path: "**/dist" | |
key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }} | |
- name: 🛠️ Setup Node for NPM | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
check-latest: true | |
registry-url: 'https://registry.npmjs.org' | |
- name: 👤 Set git user | |
run: | | |
git config --global user.email "lukemorales@live.com" | |
git config --global user.name "Luke Morales" | |
- name: 🚀 Create Changesets Pull Request or Publish to NPM | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
setupGitUser: false | |
title: "chore(changesets): bump package version" | |
commit: "chore: bump package version" | |
version: node .github/changeset-version.js | |
publish: bun run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
gpm-release: | |
name: 🚀 Release to GitHub Package Manager | |
if: ${{ github.event.inputs.force_github_package_release == 'true' || needs.release.outputs.published == 'true' }} | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: 🔑 Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🔧 Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: ♻️ Load node_modules | |
uses: actions/cache@v4 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/bun.lockb') }} | |
- name: ♻️ Load build files | |
uses: actions/cache@v4 | |
with: | |
path: "**/dist" | |
key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }} | |
- name: 🛠️ Setup Node for GPM | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
check-latest: true | |
registry-url: 'https://npm.pkg.github.com' | |
- name: 📦 Install dependencies | |
if: steps.bun-cache.outputs.cache-hit != 'true' | |
run: bun install --frozen-lockfile | |
- name: 🏷️ Overwrite package name with user scope | |
uses: sergeysova/jq-action@v2 | |
with: | |
cmd: echo "$( jq '.name="@${{ github.repository }}"' package.json )" > package.json | |
- name: 🚀 Publish to GPM | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=${{ env.NODE_AUTH_TOKEN }}" >> .npmrc | |
echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" >> .npmrc | |
npm publish --registry=https://npm.pkg.github.com | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |