-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.36 KB
/
release.yml
File metadata and controls
47 lines (40 loc) · 1.36 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
name: release
on:
workflow_dispatch:
inputs:
bump:
type: choice
options: [major, minor, patch]
default: patch
permissions:
contents: write
jobs:
prepare:
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: actions/setup-python@v5
with: { python-version: "3.10" }
- run: |
python -m pip install --upgrade pip requests
chmod +x scripts/bump_version.py
- id: bump
run: |
NEWVER=$(python scripts/bump_version.py "${{ inputs.bump }}")
echo "new_version=$NEWVER" >> $GITHUB_OUTPUT
echo "Version -> $NEWVER"
- name: commit + tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }}" || true
git push origin main
git tag -a "v${{ steps.bump.outputs.new_version }}" -m "release v${{ steps.bump.outputs.new_version }}"
git push origin "v${{ steps.bump.outputs.new_version }}"