Skip to content

Commit

Permalink
ci: add GitHub Package Registry publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
skick1234 committed Feb 22, 2025
1 parent b14917b commit a7ba429
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
types: [published]
jobs:
publish:
name: Build & Publish
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
Expand All @@ -20,17 +21,54 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: "lts/*"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile

- name: Publish
- name: Publish to npm
run: |
pnpm publish --access public --no-git-checks
pnpm deprecate distube@"< ${{ github.event.release.tag_name }}" "This version is deprecated, please upgrade to the latest version."
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_CONFIG_PROVENANCE: true

publish-gpr:
name: "Publish to GitHub Package Registry"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "pnpm"
registry-url: "https://npm.pkg.github.com"

- name: Install Dependencies
run: pnpm install --ignore-scripts --frozen-lockfile

- name: Update ~/.npmrc
run: |
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: "Publish"
run: |
pnpm publish --access public --registry https://npm.pkg.github.com --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true

0 comments on commit a7ba429

Please sign in to comment.