-
Notifications
You must be signed in to change notification settings - Fork 11
81 lines (75 loc) · 2.21 KB
/
Copy pathbump-version.yml
File metadata and controls
81 lines (75 loc) · 2.21 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
79
80
81
name: Bump Version
on:
workflow_dispatch:
inputs:
bump_type:
description: Version bump type
required: true
type: choice
options:
- tiny
- minor
- major
description:
description: Optional description for the release
required: false
type: string
target_branch:
description: Target branch
required: true
type: choice
options:
- beta
- main
permissions:
contents: write
actions: write
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.target_branch }}
fetch-depth: 0
- name: Generate GitHub App token
id: app_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.POE_CODE_AGENT_APP_ID }}
private-key: ${{ secrets.POE_CODE_AGENT_PRIVATE_KEY }}
- name: Create version bump commit
env:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
BUMP_TYPE="${{ inputs.bump_type }}"
DESCRIPTION="${{ inputs.description }}"
case "$BUMP_TYPE" in
tiny)
PREFIX="fix"
;;
minor)
PREFIX="feat"
;;
major)
PREFIX="feat"
;;
esac
if [ -n "$DESCRIPTION" ]; then
COMMIT_MSG="$PREFIX: $DESCRIPTION"
else
COMMIT_MSG="$PREFIX: release"
fi
if [ "$BUMP_TYPE" = "major" ]; then
COMMIT_MSG="$COMMIT_MSG
BREAKING CHANGE: major version bump"
fi
git commit --allow-empty -m "$COMMIT_MSG"
git push origin ${{ inputs.target_branch }}
- name: Trigger release workflow
env:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: gh workflow run release.yml -f branch=${{ inputs.target_branch }}