|
| 1 | +# This workflow will build and publish a package to GitHub Packages |
| 2 | +# For more information see: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry |
| 3 | + |
| 4 | +name: Publish to GitHub Packages |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-publish: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + packages: write |
| 18 | + pages: write |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup Bun |
| 24 | + uses: oven-sh/setup-bun@v2 |
| 25 | + with: |
| 26 | + bun-version: latest |
| 27 | + registries: | |
| 28 | + https://registry.npmjs.org/ |
| 29 | + @jazz-man:https://npm.pkg.github.com/|$GITHUB_TOKEN |
| 30 | +
|
| 31 | + - name: Install dependencies |
| 32 | + run: bun install --frozen-lockfile |
| 33 | + |
| 34 | + - name: Run tests |
| 35 | + run: bun test |
| 36 | + |
| 37 | + - name: Bump version and push tag |
| 38 | + uses: anothrNick/github-tag-action@v1 |
| 39 | + id: bump |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ github.token }} |
| 42 | + MAJOR_STRING_TOKEN: '#major' |
| 43 | + MINOR_STRING_TOKEN: '#minor' |
| 44 | + PATCH_STRING_TOKEN: '#patch' |
| 45 | + NONE_STRING_TOKEN: '#none' |
| 46 | + TAG_PREFIX: v |
| 47 | + VERBOSE: false |
| 48 | + |
| 49 | + - name: Build Changelog |
| 50 | + id: changelog |
| 51 | + uses: loopwerk/tag-changelog@v1 |
| 52 | + with: |
| 53 | + token: ${{ github.token }} |
| 54 | + |
| 55 | + - name: Release |
| 56 | + uses: softprops/action-gh-release@v2 |
| 57 | + with: |
| 58 | + token: ${{ github.token }} |
| 59 | + generate_release_notes: true |
| 60 | + append_body: true |
| 61 | + make_latest: true |
| 62 | + tag_name: ${{ steps.bump.outputs.tag }} |
| 63 | + name: ${{ steps.bump.outputs.tag }} |
| 64 | + body: ${{ steps.changelog.outputs.changelog }} |
| 65 | + |
| 66 | + - name: Bump version and publish |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ github.token }} |
| 69 | + run: | |
| 70 | + bun pm version ${{ steps.bump.outputs.tag }} --no-git-tag-version |
| 71 | +
|
| 72 | + bun publish \ |
| 73 | + --tag ${{ steps.bump.outputs.tag }} \ |
| 74 | + --tolerate-republish \ |
| 75 | + --production |
0 commit comments