Skip to content

Commit 835b987

Browse files
committed
Add manual GH action to create a new PR to bump package versions.
npm/cli#4017
1 parent 0380b51 commit 835b987

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
build:
99
name: Build
1010
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
1113
strategy:
1214
matrix:
1315
node: ["18", "20", "22"]
@@ -39,3 +41,27 @@ jobs:
3941
4042
- name: Run CI with turbo
4143
run: pnpm run ci
44+
45+
- name: Publish eslint-plugin-solid to npm if needed
46+
if: ${{ github.ref_name }} == "main"
47+
uses: JS-DevTools/npm-publish@v3
48+
with:
49+
package: ./packages/eslint-plugin-solid
50+
token: ${{ secrets.NPM_TOKEN }}
51+
strategy: upgrade
52+
access: public
53+
provenance: true
54+
# TODO remove
55+
dry-run: true
56+
57+
- name: Publish eslint-solid-standalone to npm if needed
58+
if: ${{ github.ref_name }} == "main"
59+
uses: JS-DevTools/npm-publish@v3
60+
with:
61+
package: ./packages/eslint-solid-standalone
62+
token: ${{ secrets.NPM_TOKEN }}
63+
strategy: upgrade
64+
access: public
65+
provenance: true
66+
# TODO remove
67+
dry-run: true

.github/workflows/version.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Version
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: "Semver version bump"
7+
required: true
8+
type: choice
9+
options: [patch, minor, major]
10+
jobs:
11+
version:
12+
name: Version
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
run_install: false
22+
23+
- name: Install node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "22"
27+
cache: "pnpm"
28+
29+
- name: Bump version
30+
if: ${{ github.event_name }} == "workflow_dispatch" && ${{ github.ref_name }} == "main"
31+
run: pnpm run version -- ${{ inputs.version }}
32+
33+
- name: Create PR with new versions
34+
uses: peter-evans/create-pull-request@v6
35+
with:
36+
branch: "gh-action-version"
37+
delete-branch: true
38+
title: "Update package versions"
39+
body: "Merging this PR will publish packages to npm at the new version."

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "eslint-plugin-solid-monorepo",
33
"private": true,
44
"license": "MIT",
5+
"workspaces": [
6+
"packages/*"
7+
],
58
"scripts": {
69
"build": "turbo run turbo:build",
710
"ci": "PARSER=all turbo run turbo:build turbo:test turbo:docs turbo:lint turbo:tsc",
@@ -12,7 +15,8 @@
1215
"tsc": "turbo run turbo:tsc",
1316
"turbo:docs": "cp packages/eslint-plugin-solid/README.md README.md",
1417
"turbo:lint": "eslint --max-warnings=0",
15-
"turbo:tsc": "tsc"
18+
"turbo:tsc": "tsc",
19+
"version": "sh -c 'npm version --workspace=packages/eslint-plugin-solid --workspace=packages/eslint-solid-standalone --workspaces-update=false ${0} && git add packages/*/package.json'"
1620
},
1721
"lint-staged": {
1822
"*.{js,jsx,ts,tsx}": [

0 commit comments

Comments
 (0)