Skip to content

Commit

Permalink
dx(publish): Add Automatic Publish with Provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWendelborn committed Sep 11, 2023
1 parent bc236b2 commit 1c0b268
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 17 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pipeline

on:
push:
branches: [main]

pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

- run: bun install

# update npm for provenance support
- run: npm --version && npm install -g npm && npm --version

- run: bun test

- run: bun run build

- name: dry-publish
run: cd build && npm publish --provenance --dry-run
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package to NPM

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest

permissions:
id-token: write

steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

- run: bun install

# update npm for provenance support
- run: npm --version && npm install -g npm && npm --version

# make sure this publish doesn’t break anything
- run: bun test

- run: bun run build

- name: publish
run: cd build && npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 0 additions & 14 deletions .github/workflows/push.yml

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@
"scripts": {
"build": "rm -rf build && tsc && tsc -p ./tsconfig.treeshake.json && bun run build:copy",
"build:copy": "cp package.json build && cp readme.md build && cp license.md build",
"clean": "read -p \"Are you sure you want to discard all uncommitted changes? (y/n)\" CONTINUE; if [ \"$CONTINUE\" = \"y\" ]; then git clean -dxf; else exit 1; fi && bun install",
"coverage": "bun test --coverage",
"custom-publish": "bun run clean && bun run build && bun test && echo \"cd build && npm publish\"",
"postpublish": "git tag $(bun repl -p \"require('./package.json').version\") && git push --tags",
"test": "bun test",
"watch": "bun test --watch"
},
Expand Down

0 comments on commit 1c0b268

Please sign in to comment.