Skip to content

Commit

Permalink
Refactor github actions to use matrix for publishing packages (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
rezigned committed Aug 16, 2022
1 parent 1d58c25 commit 63eacda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,30 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
node-version: ${{ env.NODE_VERSION }}
- run: |
npm ci
npm run build --if-present
npm test
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gpr:
publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
registry: ["https://registry.npmjs.org/", "https://npm.pkg.github.com/"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
registry-url: https://npm.pkg.github.com/
- run: npm publish
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ matrix.registry }}
- run: |
npm ci
npm run build --if-present
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ contains(matrix.registry, 'github.com') && secrets.GITHUB_TOKEN || secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.env
node_modules
dist
dist
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gizt/selector",
"version": "1.0.10",
"version": "1.0.11",
"description": "JSON Selector",
"keywords": [
"json",
Expand Down

0 comments on commit 63eacda

Please sign in to comment.