Skip to content

Commit f924640

Browse files
committed
ci: Add GitHub Packages publish workflow on version tags
1 parent 84f64f6 commit f924640

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

.github/workflows/publish-gpr.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish to GitHub Packages
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
publish-gpr:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
registry-url: https://npm.pkg.github.com/
22+
23+
- name: Publish to GitHub Packages
24+
run: |
25+
# Temporarily scope the package for GitHub Packages
26+
node -e "
27+
const pkg = require('./package.json');
28+
pkg.name = '@claudlos/cloding';
29+
pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
30+
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
31+
"
32+
npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)