Skip to content

Commit

Permalink
ci: add publish workflow [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Apr 9, 2024
1 parent 26ad828 commit cb740e6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: yarn install

- name: Build the library
run: yarn prepack
run: yarn build

- name: Run unit tests
run: yarn test
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Publish a package to npm when a tag starting with "v" is pushed to remote.
# Currently, only npm supports publishing packages with provenance
# https://docs.npmjs.com/generating-provenance-statements

on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: yarn install

- name: Build package
run: yarn build

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: npm publish --provenance --access public
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "vitest -r tests",
"test:integration": "node tests/test-integration",
"format": "prettier --write \"{src,tests,playground}/**/*.{js,ts,svelte,md}\" --ignore-path \".gitignore\"",
"prepack": "tsc -p tsconfig.build.json"
"build": "tsc -p tsconfig.build.json"
},
"dependencies": {
"@rollup/plugin-node-resolve": "^13.2.1",
Expand Down

0 comments on commit cb740e6

Please sign in to comment.