github action update #4
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: build-release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Repo checkout | |
| uses: actions/checkout@v4 | |
| - name: Bump version and push tag | |
| id: bump | |
| uses: hennejg/github-tag-action@v4.3.1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| release_branches: main | |
| - name: Release tag | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ steps.bump.outputs.new_tag }} | |
| generateReleaseNotes: true | |
| publish-npmjs: | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Publish package | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| publish-github: | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@hostinger' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Publish package | |
| run: | | |
| sed -i 's+"name": ".*+"name": "@${{ github.repository }}",+gI' ./package.json | |
| npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |