diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5239060..a7e8b7c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,17 +1,21 @@ name: Publish + on: release: types: [created] + jobs: publish-npm: + name: Publish to npm runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - name: Checkout the project - uses: actions/checkout@v3 - - name: Use Node.js 16.x (LTS) - uses: actions/setup-node@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18 registry-url: https://registry.npmjs.org/ cache: npm - run: npm ci @@ -19,6 +23,46 @@ jobs: - run: npm version ${TAG_NAME} --git-tag-version=false env: TAG_NAME: ${{ github.event.release.tag_name }} - - run: npm whoami; npm publish --access public + + # Provenance beta builds + # Remove when stable + - name: Clone npm + uses: actions/checkout@v3 + with: + repository: npm/cli + ref: provenance + path: npm + - name: Link npm + run: | + cd npm + node . link + cd .. + npm version + # Provenance beta builds + # Remove when stable + + - run: npm whoami; npm --ignore-scripts publish --provenance --access public env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} + publish-github: + name: Publish to GitHub Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: https://npm.pkg.github.com + cache: npm + scope: '@github' + - run: npm ci + - run: npm test + - run: npm version ${TAG_NAME} --git-tag-version=false + env: + TAG_NAME: ${{ github.event.release.tag_name }} + - run: npm --ignore-scripts publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}