feat: update npm publishing #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish new release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - "main" | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release_gh: | |
| name: Create new GitHub release | |
| if: contains(github.event.pull_request.labels.*.name, 'release') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: git config | |
| run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| - name: Generate Changelog | |
| run: node ./scripts/extract_changelog.js > ${{ github.workspace }}-CURRENT_CHANGELOG.md | |
| - name: Get latest version | |
| run: echo "PACKAGE_VERSION=$(node scripts/extract_version.js)" >> $GITHUB_ENV | |
| - name: GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: freeRASP ${{ env.PACKAGE_VERSION }} | |
| tag_name: v${{ env.PACKAGE_VERSION }} | |
| body_path: ${{ github.workspace }}-CURRENT_CHANGELOG.md | |
| publish_npmjs: | |
| name: Publish release to npm.js | |
| needs: release_gh | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Compile .ts files | |
| run: npm run ts:build | |
| shell: bash | |
| - name: Configure git | |
| run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| - name: Publish package | |
| run: npm publish |