Skip to content

Commit

Permalink
Autopublish with provenance (#535)
Browse files Browse the repository at this point in the history
* build(actions): automate publishing

* build(publish): publish with provenance

* chore: remove unused postbuild step

* docs: update CONTRIBUTING.md
  • Loading branch information
jviide committed Mar 19, 2024
1 parent 54dfc33 commit 58befba
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 30 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -8,6 +8,11 @@ on:
jobs:
release:
name: Release
permissions:
contents: write
id-token: write
issues: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,5 +34,8 @@ jobs:

- name: Create Release Pull Request
uses: changesets/action@v1
with:
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 2 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -2,10 +2,6 @@

## Releasing Signals (Maintainers only)

This guide is intended for core team members that have the necessary
rights to publish new releases on npm.
This guide is intended for core team members that have the necessary rights to merge pull requests to the `main` branch.

1. Merge "Version Packages" PR opened by the changesets-action
2. Switch to the `main` branch and pull the merged PR
3. Run `pnpm release` to publish packages
4. Commit updated `pnpm-lock.yaml` if it changed and push it: `git push -f`
To create a new release, merge "Version Packages" PR opened by the changesets-action. The release workflow will automatically create new releases for the packages that have changesets.
4 changes: 1 addition & 3 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "preact-signals",
"private": true,
"scripts": {
"prebuild": "rimraf packages/core/dist/ packages/preact/dist",
"prebuild": "rimraf packages/*/dist/",
"build": "pnpm build:core && pnpm build:preact && pnpm build:react-runtime && pnpm build:react-auto && pnpm build:react && pnpm build:react-transform",
"_build": "microbundle --raw --globals @preact/signals-core=preactSignalsCore,preact/hooks=preactHooks,@preact/signals-react/runtime=reactSignalsRuntime",
"build:core": "pnpm _build --cwd packages/core && pnpm postbuild:core",
Expand All @@ -16,7 +16,6 @@
"postbuild:react": "cd packages/react/dist && mv -f react/src/index.d.ts signals.d.ts && rm -dr react",
"postbuild:react-auto": "cd packages/react/auto/dist && mv -f react/auto/src/*.d.ts . && rm -dr react",
"postbuild:react-runtime": "cd packages/react/runtime/dist && mv -f react/runtime/src/*.d.ts . && rm -dr react",
"postbuild": "node ./scripts/node-13-exports.js",
"lint": "pnpm lint:eslint && pnpm lint:tsc",
"lint:eslint": "eslint 'packages/**/*.{ts,tsx,js,jsx}'",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
Expand All @@ -36,7 +35,6 @@
"docs:preview": "cd docs && pnpm preview",
"ci:build": "pnpm build && pnpm docs:build",
"ci:test": "pnpm lint && pnpm test",
"release": "pnpm changeset version && pnpm install && git add -A && git commit -m 'Version Packages' && changeset tag && pnpm publish -r",
"prepare": "husky install",
"format": "prettier --ignore-path .gitignore --write '**/*.{js,jsx,ts,tsx,yml,json,md}'"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/core/package.json
Expand Up @@ -42,5 +42,8 @@
"CHANGELOG.md",
"LICENSE",
"README.md"
]
],
"publishConfig": {
"provenance": true
}
}
3 changes: 3 additions & 0 deletions packages/preact/package.json
Expand Up @@ -52,5 +52,8 @@
"devDependencies": {
"preact": "10.9.0",
"preact-render-to-string": "^5.2.5"
},
"publishConfig": {
"provenance": true
}
}
3 changes: 3 additions & 0 deletions packages/react-transform/package.json
Expand Up @@ -72,5 +72,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.9.0"
},
"publishConfig": {
"provenance": true
}
}
3 changes: 3 additions & 0 deletions packages/react/package.json
Expand Up @@ -77,5 +77,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.9.0"
},
"publishConfig": {
"provenance": true
}
}
20 changes: 0 additions & 20 deletions scripts/node-13-exports.js

This file was deleted.

0 comments on commit 58befba

Please sign in to comment.