forked from uraimo/run-on-arch-action
-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (25 loc) · 906 Bytes
/
floating-tag.yml
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
name: Update floating tag
on:
push:
tags:
# Only match vXX.YY.ZZ tags
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
update-tag:
runs-on: ubuntu-latest
name: Update floating tag
steps:
- uses: actions/checkout@v3
- uses: fregante/setup-git-user@v1
- name: Tag and push
run: |
# Parse tag name, e.g. "v2" from "refs/tags/v2.22.12"
parse='import sys; print(sys.argv[1].split("/")[-1].split(".")[0])'
tag=$(python -c "$parse" "$GITHUB_REF")
# Empty commit that skips CI to prevent the `[remote rejected]` error.
# Error is due to the default GITHUB_TOKEN not having the `workflows`
# permission. Also prevents unnecessary test runs.
git commit --allow-empty -m "Tagged $tag from $GITHUB_REF [skip ci]"
# Overwrite tag
git tag -f "$tag"
git push -f origin "$tag"