Publish #31
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
| # Copyright (c) 2025-present VPMedia | |
| # author: Andras Csizmadia <[email protected]> | |
| name: Publish | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| name: Publish package | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| node-version: [24.X] | |
| steps: | |
| - name: Set start timestamp | |
| id: start_timestamp | |
| run: echo "timestamp=$EPOCHSECONDS" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # 6.0.9 | |
| with: | |
| version: 10 | |
| run_install: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # 7.0.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: pnpm | |
| - name: Audit | |
| run: pnpm audit --prod --ignore-registry-errors | |
| - name: Init | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint | |
| run: pnpm run lint | |
| - name: Test | |
| run: pnpm run test | |
| - name: Build | |
| run: pnpm run build | |
| - name: Version | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| pnpm version minor -m "chore(release): v%s" | |
| - name: Changelog | |
| uses: orhun/git-cliff-action@f50e11560dce63f7c33227798f90b924471a88b5 # 4.8.0 | |
| env: | |
| OUTPUT: CHANGELOG.md | |
| - name: Commit | |
| run: | | |
| git add -A | |
| git commit --message "ci: release" | |
| git push --follow-tags | |
| - name: Publish | |
| run: pnpm publish --provenance --access public | |
| env: | |
| NPM_CONFIG_PROVENANCE: true | |
| - name: Calculate workflow duration | |
| id: workflow_duration | |
| env: | |
| START_TIMESTAMP: ${{ steps.start_timestamp.outputs.timestamp }} | |
| run: echo "timedelta=$((EPOCHSECONDS - START_TIMESTAMP))" >> "$GITHUB_OUTPUT" | |
| if: always() | |
| - uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # 4.0.0 | |
| with: | |
| errors: true | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: > | |
| { | |
| "channel": "dev-github", | |
| "text": " ", | |
| "attachments": [ | |
| { | |
| "fallback": "${{ github.repository }} - ${{ github.workflow }} workflow status", | |
| "color": "${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}", | |
| "title": "${{ github.workflow }} workflow", | |
| "title_link": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
| "pretext": "*${{ github.repository }}*", | |
| "text": "*Status:* ${{ job.status }}\n*Branch:* ${{ github.base_ref || github.ref_name }}", | |
| "footer": "Committed by ${{ github.event.head_commit.author.name || github.actor }} | Completed in ${{ steps.workflow_duration.outputs.timedelta }}s", | |
| "footer_icon": "https://avatars.githubusercontent.com/${{ github.event.head_commit.author.username || github.actor }}" | |
| } | |
| ] | |
| } | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| if: always() |