Skip to content

Commit

Permalink
ci: adjustments to gpm release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorales committed Feb 2, 2024
1 parent a086a4e commit f97d8f6
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release to package managers
name: release

concurrency: ${{ github.workflow }}-${{ github.ref }}

Expand All @@ -9,7 +9,7 @@ on:
workflow_dispatch:
inputs:
force_github_package_release:
description: Force GPR release
description: Force GPM release
type: boolean
required: false
default: false
Expand Down Expand Up @@ -97,9 +97,9 @@ jobs:
key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }}

- name: 🛠️ Setup Node for NPM
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: latest
node-version: '20.x'
check-latest: true
registry-url: 'https://registry.npmjs.org'

Expand All @@ -122,14 +122,14 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

gpr-release:
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, release]
needs: [build]
permissions:
contents: read
packages: write
contents: read
steps:
- name: 🔑 Checkout Repository
uses: actions/checkout@v4
Expand All @@ -145,27 +145,29 @@ jobs:
path: "**/node_modules"
key: ${{ runner.os }}-node-${{ hashFiles('**/bun.lockb') }}

- name: 🛠️ Setup Node for GPR
uses: actions/setup-node@v3
- name: ♻️ Load build files
uses: actions/cache@v4
with:
node-version: latest
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: 👤 Set git user
run: |
git config --global user.email "lukemorales@live.com"
git config --global user.name "Luke Morales"
scope: ${{ github.repository_owner }}

- name: 📦 Install dependencies
if: steps.bun-cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile

- name: ⚒️ Build package
run: bun run build

- name: 🚀 Publish to GPR
run: npm publish
- name: 🚀 Publish to GPM
run: |
echo "//npm.pkg.github.com/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc
echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" >> .npmrc
npm login --scope=@${{ github.repository_owner }} --registry=https://npm.pkg.github.com --auth-type=legacy
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit f97d8f6

Please sign in to comment.