Skip to content

Commit

Permalink
chore: Add CI workflows for NPM package publish automation
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmilton committed Jun 26, 2024
1 parent f170ded commit 0681b81
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: publish
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
steps:
- name: Check valid version tag
run: |
[[ "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)? ]] || exit 1
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: latest
registry-url: 'https://registry.npmjs.org'
- run: bun install --frozen-lockfile
- run: bun run lint
- run: bun run test
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: release
on:
push:
tags: [v*.*.*]
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run lint
- run: bun run test
- run: gh release create "${{ github.ref_name }}" --draft --generate-notes
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 0681b81

Please sign in to comment.