-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.67 KB
/
increment_version.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Update package version
on:
workflow_dispatch:
inputs:
version-increment-type:
description: "What would you like to increment? Major, minor or patch?"
required: true
default: "patch"
type: choice
options:
- major
- minor
- patch
jobs:
increment-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22.14.0
cache: "yarn"
- name: Configure git
run: |
git config user.name 'GHA Workflow'
git config user.email '-'
- name: Increment package version
run: |
git log
NEW_VERSION=`npm version --git-tag-version=false ${{ github.event.inputs.version-increment-type }}`
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV # Save to environment
- name: Rebuild dist
run: |
rm -Rf dist
yarn install --frozen-lockfile
yarn build
- name: Commit & Push
run: |
git add -f package.json dist
git commit -m "New build + update package version to $NEW_VERSION"
git log
git checkout -b package-version-update
git push --force origin package-version-update
NEW_TAG="v$NEW_VERSION"
git push --force origin $NEW_TAG
- name: Create Pull Request
run: |
gh pr create --base main --head package-version-update --title "Update package version to $NEW_VERSION" --body "This PR was created automatically."
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}