-
Notifications
You must be signed in to change notification settings - Fork 33
34 lines (25 loc) · 830 Bytes
/
Copy pathon-tag.yml
File metadata and controls
34 lines (25 loc) · 830 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
34
name: Create shortened tags
# Only triggered on git tag push
on:
push:
tags: [ 'v*' ]
jobs:
shorten:
name: Short tags
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set environment
run: |
cd "$GITHUB_WORKSPACE"
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
echo "::set-env name=TAG::${GITHUB_REF#refs/tags/}"
- name: Create, or update the short-name branch
if: startsWith(env.TAG, 'v0.0') != true
run: |
SHORT="$(echo "${TAG#v}" | cut -d. -f-2)"
git branch -f "$SHORT" "$TAG"
git push --force \
"https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" \
"$SHORT"