Skip to content

Commit

Permalink
feat(ci): publish to github registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilaton committed Dec 11, 2023
1 parent f181483 commit 552a4f4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
permissions:
contents: write
pull-requests: write
packages: write
id-token: write

jobs:
Expand Down Expand Up @@ -36,8 +37,8 @@ jobs:
run: pnpm run ci

release-please-action:
needs: [test]
runs-on: ubuntu-latest
needs: ["test"]
steps:
- uses: google-github-actions/release-please-action@main
id: release-action
Expand All @@ -47,16 +48,25 @@ jobs:
is-release-created: ${{ steps.release-action.outputs.release_created }}

release:
needs: [release-please-action]
if: ${{ needs.release-please-action.outputs.is-release-created == 'true' }}
runs-on: ubuntu-latest
needs: ["release-please-action"]
if: ${{ needs.release-please-action.outputs.is-release-created }}
strategy:
matrix:
include:
- name: NPM
registry: https://registry.npmjs.org/
token-name: NPM_TOKEN
- name: GitHub Packages
registry: https://npm.pkg.github.com/
token-name: GITHUB_TOKEN
steps:
- uses: actions/checkout@main

- uses: actions/setup-node@main
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
node-version: '20.x'
registry-url: ${{ matrix.registry }}

- name: Install pnpm
uses: pnpm/action-setup@master
Expand All @@ -69,7 +79,8 @@ jobs:
- name: Build package
run: pnpm run build

- name: Publish to npm
run: pnpm publish --no-git-checks --provenance --access public
- name: Publish to ${{ matrix.name }}
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets[matrix.token-name] }}
NPM_CONFIG_PROVENANCE: true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "pmjs",
"name": "pubun",
"version": "1.0.1",
"description": "Asynchronous library with built-in caching to identify available package managers",
"exports": {
Expand Down

0 comments on commit 552a4f4

Please sign in to comment.