release.yml 886 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: Release
  2. on:
  3. release:
  4. types: [published]
  5. permissions:
  6. contents: read
  7. id-token: write
  8. jobs:
  9. build:
  10. runs-on: ubuntu-latest
  11. strategy:
  12. matrix:
  13. node-version: [22]
  14. steps:
  15. - uses: actions/checkout@v4
  16. - name: Use Node.js ${{ matrix.node-version }}
  17. uses: actions/setup-node@v4
  18. with:
  19. node-version: ${{ matrix.node-version }}
  20. registry-url: 'https://registry.npmjs.org'
  21. cache: 'npm'
  22. - name: Install dependencies
  23. run: npm install
  24. - name: Test
  25. run: npm test
  26. - name: Calculate environment variables
  27. run: |
  28. echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
  29. - name: Publish
  30. run: npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
  31. env:
  32. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}