name: Publish npm packages concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false on: workflow_dispatch: inputs: environment: description: "Must match your username" required: true type: choice options: - notaphplover permissions: contents: write pull-requests: write jobs: publish: name: Publish npm packages runs-on: ubuntu-latest environment: name: ${{ inputs.environment }} steps: - name: Validate environment matches actor run: | echo "Actor: ${{ github.actor }}" echo "Environment: ${{ inputs.environment }}" if [ "${{ inputs.environment }}" != "${{ github.actor }}" ]; then echo "::error::Environment must match your username" exit 1 fi - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: fetch-depth: 0 - uses: ./.github/actions/setup with: # registry.npmjs.org is already npm's default registry; this does not change where # packages are published. actions/setup-node only wires auth when registry-url is set: # it writes an .npmrc that maps //registry.npmjs.org/:_authToken to NODE_AUTH_TOKEN. # Required because changesets/action@v2 no longer creates that .npmrc from NPM_TOKEN. registry-url: https://registry.npmjs.org/ - name: Publish npm packages uses: changesets/action@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0 with: publish-script: pnpm run release github-token: ${{ secrets.GITHUB_TOKEN }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}