-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (33 loc) · 1.21 KB
/
tag-release.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
30
31
32
33
34
35
36
name: tag release
on:
push:
branches:
- main
- master
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: "Create Version"
id: version_cfg
# note: Go lang requires tag format: v0.12.3-4
# see: https://stackoverflow.com/questions/62140832/why-golang-packages-have-to-be-v0-or-v1-and-not-v2020
run: |-
VER_BUILD=$(date +%H%M)
# limit to only first 3 chars
VER_BUILD=${VER_BUILD:0:3}
# 'strict' semver segments cannot start with 0
VERSION_NUM="0.$(date +%y)$(date +%m).$(date +%-d)-${VER_BUILD#0}"
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT
# recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int.
VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}"
echo "VERSION_INT=${VERSION_INT}" >> $GITHUB_OUTPUT
- name: "Tag release"
uses: actions/create-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version_cfg.outputs.VERSION_NUM }}
release_name: v${{ steps.version_cfg.outputs.VERSION_NUM }}
draft: false
prerelease: false