-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (37 loc) · 1.18 KB
/
create-version-tag.yaml
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
on:
push:
branches:
# - main
name: Create version tag
jobs:
tag_main_commit:
name: Check for tag-triggering commit to `main`
runs-on: ubuntu-latest
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build" # share the cache across jobs
save-if: false
- name: Install Ripgrep
run: cargo install ripgrep
- name: Is this a commit we need to tag?
id: tag_check
run: |
is_tagged_commit=$( \
echo "${{ github.event.head_commit.message }}" \
| rg "^🚀 Bump version to \d+\.\d+\.\d+" | wc -l \
)
echo "is_tagged_commit=$(($is_tagged_commit))" >> $GITHUB_OUTPUT
- name: Create the tag
if: steps.tag_check.outputs.is_tagged_commit == 1
id: get-version
run: |
new_version=$( \
echo "${{ github.event.head_commit.message }}" \
| cut -d " " -f 5 \
)
echo "tag_version=v${new_version}" >> $GITHUB_OUTPUT
- run: echo "${{ steps.get-version.tag_version }}"
if: steps.tag_check.outputs.is_tagged_commit == 1