Skip to content

Commit f87679f

Browse files
committed
auto version bump workflows
1 parent f6c7a6f commit f87679f

File tree

4 files changed

+118
-4
lines changed

4 files changed

+118
-4
lines changed

.github/workflows/npm-md-css.yml

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,51 @@
1-
name: Publish md-css to npm
1+
name: Bump and publish md-css to npm
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- main
77
paths:
88
- 'packages/css/**'
9+
types:
10+
- closed
911

1012
jobs:
13+
bump:
14+
name: Bump package version
15+
if: github.event.pull_request.merged == true
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: ./packages/css
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version: 20
27+
cache: 'npm'
28+
- name: Git config
29+
run: |
30+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
31+
git config --global user.name "github-actions[bot]"
32+
- name: Apply version bump (major)
33+
if: contains(github.event.pull_request.labels.*.name, 'major')
34+
run: npm version major
35+
- name: Apply version bump (minor)
36+
if: contains(github.event.pull_request.labels.*.name, 'minor')
37+
run: npm version minor
38+
- name: Apply version bump (patch)
39+
if: contains(github.event.pull_request.labels.*.name, 'patch')
40+
run: npm version patch
41+
- name: Git push version bump
42+
run: git push origin main --force
43+
- id: set-version
44+
name: Output version change
45+
run: npm pkg get version
46+
1147
build:
48+
name: Build & Publish
1249
runs-on: ubuntu-latest
1350
defaults:
1451
run:

.github/workflows/npm-md-react.yml

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,51 @@
1-
name: Publish md-react to npm
1+
name: Bump and publish md-react to npm
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- main
77
paths:
88
- 'packages/react/**'
9+
types:
10+
- closed
911

1012
jobs:
13+
bump:
14+
name: Bump package version
15+
if: github.event.pull_request.merged == true
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: ./packages/react
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version: 20
27+
cache: 'npm'
28+
- name: Git config
29+
run: |
30+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
31+
git config --global user.name "github-actions[bot]"
32+
- name: Apply version bump (major)
33+
if: contains(github.event.pull_request.labels.*.name, 'major')
34+
run: npm version major
35+
- name: Apply version bump (minor)
36+
if: contains(github.event.pull_request.labels.*.name, 'minor')
37+
run: npm version minor
38+
- name: Apply version bump (patch)
39+
if: contains(github.event.pull_request.labels.*.name, 'patch')
40+
run: npm version patch
41+
- name: Git push version bump
42+
run: git push origin main --force
43+
- id: set-version
44+
name: Output version change
45+
run: npm pkg get version
46+
1147
build:
48+
name: Build & Publish
1249
runs-on: ubuntu-latest
1350
defaults:
1451
run:
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'PR Label Checker'
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- 'packages/react/**'
8+
- 'packages/css/**'
9+
types: [opened, labeled, unlabeled, synchronize]
10+
11+
jobs:
12+
check_labels:
13+
name: 'Check PR Labels'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: mheap/github-action-required-labels@v5
17+
with:
18+
mode: exactly
19+
count: 1
20+
labels: 'major, minor, patch'

.github/workflows/pr-label-prompt.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'PR Label Prompt'
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/react/**'
9+
- 'packages/css/**'
10+
types: [opened]
11+
jobs:
12+
add_comment:
13+
name: 'Prompt for versioning label'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- uses: mshick/add-pr-comment@v2
19+
with:
20+
message: Please set a versioning label of either `major`, `minor`, or `patch` to the pull request.

0 commit comments

Comments
 (0)