-
Notifications
You must be signed in to change notification settings - Fork 156
89 lines (81 loc) · 2.54 KB
/
Copy pathrelease-bump.yml
File metadata and controls
89 lines (81 loc) · 2.54 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
82
83
84
85
86
87
88
89
name: Release bump
on:
workflow_dispatch:
inputs:
bump_type:
description: 'Version bump type'
type: choice
required: true
options:
- patch
- minor
- major
- prerelease
- graduate
default: patch
prerelease_label:
description: 'Pre-release label (leave empty for stable)'
type: choice
required: false
options:
- ''
- alpha
- beta
- rc
default: ''
permissions:
contents: write
pull-requests: write
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v6
with:
ref: master
fetch-depth: 0
- name: Compute next version
id: ver
run: |
set -euo pipefail
chmod +x .github/scripts/next_version.sh
CUR=$(jq -r '.version' custom_components/gree/manifest.json)
NEW=$(.github/scripts/next_version.sh "$CUR" "${{ inputs.bump_type }}" "${{ inputs.prerelease_label }}")
echo "Current: $CUR"
echo "Next: $NEW"
echo "new_version=$NEW" >> "$GITHUB_OUTPUT"
- name: Write manifest.json
env:
NEW: ${{ steps.ver.outputs.new_version }}
run: |
set -euo pipefail
tmp=$(mktemp)
jq --indent 2 --arg v "$NEW" '.version = $v' custom_components/gree/manifest.json > "$tmp"
mv "$tmp" custom_components/gree/manifest.json
echo "manifest.json updated:"
cat custom_components/gree/manifest.json
- name: Create branch and commit
env:
NEW: ${{ steps.ver.outputs.new_version }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
BRANCH="release/${NEW}"
git checkout -b "$BRANCH"
git add custom_components/gree/manifest.json
git commit -m "Release ${NEW}"
git push origin "$BRANCH"
- name: Open pull request
env:
NEW: ${{ steps.ver.outputs.new_version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh pr create \
--base master \
--head "release/${NEW}" \
--title "Release ${NEW}" \
--body "Bumps manifest version to \`${NEW}\`.
Merging this PR will tag \`${NEW}\` and publish a GitHub Release with auto-generated notes."