GitHub #86
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: "GitHub" | |
| on: | |
| workflow_run: | |
| workflows: | |
| - "Release" | |
| types: | |
| - completed | |
| permissions: | |
| packages: write | |
| contents: read | |
| jobs: | |
| pack: | |
| if: ${{ github.event.workflow_run.event == 'release' && github.event.workflow_run.conclusion == 'success' }} | |
| name: "Pack" | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| # Download Artifact from parent run | |
| - name: Download artifacts from parent run | |
| uses: actions/download-artifact@v4 | |
| with: | |
| run-id: ${{ github.event.workflow_run.id }} | |
| # Setup Bun | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.1 | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: bun install | |
| # Set Version | |
| - name: Set TAG variable | |
| run: | | |
| echo "Full ref: ${{ github.event.workflow_run.head_branch }}" | |
| echo "TAG=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV | |
| - name: Set VERSION variable | |
| run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
| - name: Set Version | |
| run: npm version $VERSION --no-git-tag-version | |
| # Setup npmrc | |
| - name: Create .npmrc | |
| run: | | |
| { | |
| echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" | |
| } | tee -a .npmrc | |
| # Publish | |
| - name: Publish | |
| run: npm publish |