Skip to content

Commit 505cd7a

Browse files
committed
Add GitHub Packages publishing to CI/CD pipeline
- Add publish-github job for dual publishing - Publish to both npm and GitHub Packages on release - Set proper permissions for GitHub Packages - Remove separate publish workflow
1 parent 2112d5b commit 505cd7a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,34 @@ jobs:
6060
env:
6161
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6262

63+
publish-github:
64+
needs: test
65+
runs-on: ubuntu-latest
66+
if: github.event_name == 'release' && github.event.action == 'published'
67+
permissions:
68+
contents: read
69+
packages: write
70+
71+
steps:
72+
- uses: actions/checkout@v3
73+
74+
- name: Use Node.js for GitHub Packages
75+
uses: actions/setup-node@v3
76+
with:
77+
node-version: '18.x'
78+
registry-url: 'https://npm.pkg.github.com'
79+
80+
- name: Install dependencies
81+
run: npm install --ignore-scripts
82+
83+
- name: Run tests
84+
run: npm test
85+
86+
- name: Publish to GitHub Packages
87+
run: npm publish
88+
env:
89+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
6391
lint:
6492
runs-on: ubuntu-latest
6593

0 commit comments

Comments
 (0)