Skip to content

Commit cd206d5

Browse files
authored
ci(*): drop bump.yml and create new version-monorepo.yml workflow (#247)
This pull request includes several changes related to the configuration and workflows of the repository. The most significant changes involve the reorganization and updating of GitHub Actions workflows, particularly the removal of the `bump.yml` workflow and the addition of the `version-monorepo.yml` workflow. ### Workflow Updates and Reorganization: * Removed the `bump.yml` workflow, which handled version bumps for different types of releases. * Added a new `version-monorepo.yml` workflow to handle version bumps with more detailed configuration options, including semver and preid selections. This workflow also drafts releases and creates pull requests. ### Configuration File Updates: * Updated `.editorconfig-checker.json` to exclude `lerna.json` from checks. * Updated `.github/sync-client.yml` to reflect changes in the workflows being synchronized, including the removal of `bump.yml` and the addition of `version-monorepo.yml`. [[1]](diffhunk://#diff-93bc202766315b6269beef308a6ad30ed3e86938ddbfa31b49e030f2263695f1L12-L13) [[2]](diffhunk://#diff-93bc202766315b6269beef308a6ad30ed3e86938ddbfa31b49e030f2263695f1R22-R23)
1 parent 9c56623 commit cd206d5

File tree

4 files changed

+122
-84
lines changed

4 files changed

+122
-84
lines changed

.editorconfig-checker.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"Exclude": ["git-clang-format"]
2+
"Exclude": ["git-clang-format", "lerna.json"]
33
}

.github/sync-client.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ lumirlumir/lumirlumir-configs:
99
- source: ./.github/ISSUE_TEMPLATE/3-others.md
1010
dest: ./configs/.github/ISSUE_TEMPLATE/3-others.md
1111
# ./.github/workflows
12-
- source: ./.github/workflows/bump.yml
13-
dest: ./configs/.github/workflows/monorepo-bump.yml
1412
- source: ./.github/workflows/lint.yml
1513
dest: ./configs/.github/workflows/lint.yml
1614
- source: ./.github/workflows/publish.yml
@@ -21,6 +19,8 @@ lumirlumir/lumirlumir-configs:
2119
dest: ./configs/.github/workflows/sync-client.yml
2220
- source: ./.github/workflows/test.yml
2321
dest: ./configs/.github/workflows/test.yml
22+
- source: ./.github/workflows/version-monorepo.yml
23+
dest: ./configs/.github/workflows/version-monorepo.yml
2424
# ./.github
2525
- source: ./.github/CODEOWNERS
2626
dest: ./configs/.github/CODEOWNERS

.github/workflows/bump.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: version-monorepo
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
semver:
7+
description: Select the semver of the new release
8+
required: true
9+
type: choice
10+
default: patch
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
- prerelease
16+
- prepatch
17+
- preminor
18+
- premajor
19+
preid:
20+
description: Select the preid of prerelease version
21+
required: false
22+
type: choice
23+
default: canary
24+
options:
25+
- canary
26+
- alpha
27+
- beta
28+
- rc
29+
30+
permissions:
31+
contents: write
32+
pull-requests: write
33+
34+
jobs:
35+
version-monorepo:
36+
runs-on: ubuntu-latest
37+
38+
env:
39+
GH_TOKEN: ${{ secrets.GH_PAT }}
40+
41+
steps:
42+
- name: Set up checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Set up node
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version-file: .nvmrc
49+
cache: npm
50+
51+
- name: Set up cache
52+
uses: actions/cache@v4
53+
with:
54+
path: ~/.npm
55+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
56+
57+
- name: Set up node_modules
58+
run: npm ci
59+
60+
- name: Set up environment variables
61+
run: |
62+
echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
63+
echo "OLD_VERSION=$(node -p "require('./lerna.json').version")" >> $GITHUB_ENV
64+
65+
- name: Version bump (patch, minor, major) # `--no-git-tag-version` includes `--no-push`
66+
if: ${{ inputs.semver == 'patch' || inputs.semver == 'minor' || inputs.semver == 'major' }}
67+
run: npx lerna version ${{ inputs.semver }} --no-git-tag-version --yes
68+
69+
- name: Version bump (prerelease, prepatch, preminor, premajor) # `--no-git-tag-version` includes `--no-push`
70+
if: ${{ inputs.semver == 'prerelease' || inputs.semver == 'prepatch' || inputs.semver == 'preminor' || inputs.semver == 'premajor' }}
71+
run: npx lerna version ${{ inputs.semver }} --no-git-tag-version --yes --preid ${{ inputs.preid }}
72+
73+
- name: Set up environment variables
74+
run: echo "NEW_VERSION=$(node -p "require('./lerna.json').version")" >> $GITHUB_ENV
75+
76+
- name: Draft release (patch, minor, major)
77+
if: ${{ inputs.semver == 'patch' || inputs.semver == 'minor' || inputs.semver == 'major' }}
78+
run: gh release create v${{ env.NEW_VERSION }} --draft --generate-notes
79+
80+
- name: Draft release (prerelease, prepatch, preminor, premajor)
81+
if: ${{ inputs.semver == 'prerelease' || inputs.semver == 'prepatch' || inputs.semver == 'preminor' || inputs.semver == 'premajor' }}
82+
run: gh release create v${{ env.NEW_VERSION }} --draft --generate-notes --prerelease
83+
84+
- name: Get release info
85+
run: |
86+
{
87+
echo "RELEASE_INFO<<EOF"
88+
gh release view v${{ env.NEW_VERSION }} --json body | jq -r '.body'
89+
echo "EOF"
90+
} >> $GITHUB_ENV
91+
92+
- name: Create pull request
93+
uses: peter-evans/create-pull-request@v7
94+
with:
95+
token: ${{ secrets.GH_PAT }}
96+
commit-message: 'chore(release): bump package versions from `v${{ env.OLD_VERSION }}` to `v${{ env.NEW_VERSION }}`'
97+
branch: 'chore-release-bump-package-versions-from-v${{ env.OLD_VERSION }}-to-v${{ env.NEW_VERSION }}-${{ env.SHORT_SHA }}'
98+
base: 'main'
99+
assignees: ${{ github.actor }}
100+
title: 'chore(release): bump package versions from `v${{ env.OLD_VERSION }}` to `v${{ env.NEW_VERSION }}` (`${{ inputs.semver }}`)'
101+
body: |
102+
## Release Information: `v${{ env.NEW_VERSION }}`
103+
104+
New release of `${{ github.repository }}` has arrived! :tada:
105+
106+
This PR bumps the package versions from `v${{ env.OLD_VERSION }}` to `v${{ env.NEW_VERSION }}` (`${{ inputs.semver }}`).
107+
108+
See [Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.
109+
110+
| Info | Value |
111+
| ----------- | -------------------------- |
112+
| Repository | `${{ github.repository }}` |
113+
| SEMVER | `${{ inputs.semver }}` |
114+
| Pre ID | `${{ inputs.preid }}` |
115+
| Short SHA | ${{ env.SHORT_SHA }} |
116+
| Old Version | `v${{ env.OLD_VERSION }}` |
117+
| New Version | `v${{ env.NEW_VERSION }}` |
118+
119+
${{ env.RELEASE_INFO }}

0 commit comments

Comments
 (0)