Skip to content

Commit

Permalink
fix: pass correct permissions and token to action
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Feb 4, 2024
1 parent b209f79 commit 841f6c2
Showing 1 changed file with 34 additions and 22 deletions.
56 changes: 34 additions & 22 deletions .github/workflows/publish-typescript-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@ env:
ACTIONS_RUNNER_DEBUG: true

jobs:
changelog:
# manually temporarily disabled
if: false
name: 'Generate Changelog'
runs-on: ['ubuntu-latest']
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Generate Changelog'
run: npm_config_yes=true npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-npm:
# manually temporarily disabled
if: false
Expand Down Expand Up @@ -76,16 +60,19 @@ jobs:
- name: 'Publish to NPM'
working-directory: './typescript-sdk'
run: |
npm publish --access='public' --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# https://docs.npmjs.com/generating-provenance-statements
NPM_CONFIG_PROVENANCE: true
run: |
npm publish --access='public' --no-git-checks
publish-github:
name: 'Publish GitHub Package Registry'
permissions:
contents: read
id-token: write
contents: write
packages: write
runs-on: ['ubuntu-latest']
steps:
- name: 'Checkout'
Expand All @@ -101,20 +88,45 @@ jobs:
- name: 'Install Nix'
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:${{ env.NIXPKGS_CHANNEL }}
github_access_token: ${{ github.token }}
nix_path: nixpkgs=channel:${{ env.NIXPKGS_CHANNEL }}
- run: |
nix-channel --add https://nixos.org/channels/${{ env.NIXPKGS_CHANNEL }} nixpkgs
nix-channel --update
- name: 'Update ~/.npmrc'
working-directory: './typescript-sdk'
run: |
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Build SDK'
working-directory: './typescript-sdk'
run: |
nix build .#typescript-sdk -o dist
- name: 'Publish to GitHub Package Registry'
working-directory: './typescript-sdk'
env:
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://docs.npmjs.com/generating-provenance-statements
NPM_CONFIG_PROVENANCE: true
run: |
npm publish --access='private' --no-git-checks
yarn publish --access='public' --registry='https://npm.pkg.github.com' --no-git-checks
changelog:
# manually temporarily disabled
if: false
name: 'Generate Changelog'
runs-on: ['ubuntu-latest']
needs: ['publish-npm']
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Generate Changelog'
run: npm_config_yes=true npx changelogithub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 841f6c2

Please sign in to comment.