forked from ionic-team/capacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.37 KB
/
bump_version.yml
File metadata and controls
78 lines (67 loc) · 2.37 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Bump version
on:
push:
branches:
- plus
paths-ignore:
- '**.md'
- '.github/**'
jobs:
# Run all tests first before creating any tags
test:
timeout-minutes: 30
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'Release') }}
uses: ./.github/workflows/test.yml
# Only bump version and create tag if all tests pass
bump-version:
timeout-minutes: 30
needs: [test]
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'Release') }}
runs-on: ubuntu-latest
name: "Bump version and create tag"
steps:
- name: Check out
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: blob:none
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
ref: plus
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22.x
- name: Install dependencies
run: npm install
- name: Git config
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
- name: Build packages
run: |
npm run build --workspace=core
npm run build --workspace=cli
- name: Bump version and create tag
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
# Use lerna to bump version with conventional commits
npx lerna version patch \
--conventional-commits \
--force-publish \
--yes \
--no-push \
--no-git-tag-version
# Get the new version
VERSION=$(node -p "require('./core/package.json').version")
echo "New version: $VERSION"
# Commit version changes and create tag
git add -A
git commit -m "chore(release): $VERSION" || true
git tag "$VERSION"
- name: Push to origin
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git pull $remote_repo $CURRENT_BRANCH || true
git push $remote_repo HEAD:$CURRENT_BRANCH --follow-tags --tags