Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add a publish workflow #62

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release Package
on:
push:
tags:
- v*

jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Get package version
id: get-package-version
shell: bash
run: |
echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT

- name: Ensure tag matches package versions
shell: bash
run: |
test "${{ github.ref_name }}" == "v${{ steps.get-package-version.outputs.version }}"

- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: "${{ github.ref_name }}"
generateReleaseNotes: true
makeLatest: true

publish:
name: Publish Package
runs-on: ubuntu-latest
needs: release

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Setup build environment
uses: ./.github/actions/setup

- name: Build distribution
shell: bash
run: pnpm build

- name: Publish package
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true