diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0a1f669 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1069fa2 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }}