-
Notifications
You must be signed in to change notification settings - Fork 21
33 lines (27 loc) · 912 Bytes
/
Copy pathtag.yml
File metadata and controls
33 lines (27 loc) · 912 Bytes
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
name: Tag After Bump
on:
push:
branches:
- main
paths:
- CHANGELOG.md
- novel_downloader/__init__.py
permissions:
contents: write
jobs:
tag:
if: "${{ startsWith(github.event.head_commit.message, 'chore(release): bump version to') }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract version from commit message
id: extract
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oP 'bump version to \K[0-9]+\.[0-9]+\.[0-9]+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.extract.outputs.version }}"
git push origin "v${{ steps.extract.outputs.version }}"