Skip to content

Commit 89f66b4

Browse files
committed
FEATURE: Automate release workflow
1 parent 1836d0d commit 89f66b4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Version Bump and Tag
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'New version number (X.Y.Z format)'
8+
required: true
9+
type: string
10+
tag_message:
11+
description: 'Tag message'
12+
required: true
13+
type: string
14+
15+
jobs:
16+
bump-version:
17+
if: github.ref == 'refs/heads/master'
18+
runs-on: ubuntu-latest
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Validate version format
27+
run: |
28+
if ! [[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
29+
echo "Invalid version format. Must be X.Y.Z"
30+
exit 1
31+
fi
32+
33+
- name: Update version in __init__.py
34+
run: |
35+
sed -i 's/__version__ = ".*"/__version__ = "${{ github.event.inputs.version }}"/' ardupilot_methodic_configurator/__init__.py
36+
37+
- name: Commit and push changes
38+
run: |
39+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
40+
git config --local user.name "github-actions[bot]"
41+
git add ardupilot_methodic_configurator/__init__.py
42+
git commit -m "CHORE: Bump version info, tag and release"
43+
git push
44+
45+
- name: Create and push tag
46+
run: |
47+
git tag -a "v${{ github.event.inputs.version }}" -m "${{ github.event.inputs.tag_message }}"
48+
git push origin "v${{ github.event.inputs.version }}"

0 commit comments

Comments
 (0)