-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (56 loc) · 1.7 KB
/
ci-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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: ci-release
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
GVD_VERSION_FNAME: "version.txt"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "calculate release version"
run: |
git pull
if [ -f "${GVD_VERSION_FNAME}" ]
then
GVD_VERSION=$(cat ${GVD_VERSION_FNAME})
GVD_DATE=$(echo ${GVD_VERSION} | cut -d. -f1-2)
GVD_SERIAL=$(echo ${GVD_VERSION} | cut -d. -f3)
NOW_DATE=$(date +%Y.%m)
NOW_SERIAL=0
if [ "${GVD_DATE}" == "${NOW_DATE}" ]
then
NOW_SERIAL=$(expr ${GVD_SERIAL} + 1)
fi
GVD_VERSION="${NOW_DATE}.${NOW_SERIAL}"
else
GVD_VERSION="$(date +%Y.%m).0"
echo "GVD_BOOTSTRAP=1" >> ${GITHUB_ENV}
fi
echo "GVD_VERSION=${GVD_VERSION}" >> ${GITHUB_ENV}
- name: "store release version"
run: |
echo ${{ env.GVD_VERSION }} > ${GVD_VERSION_FNAME}
if [ -n "${GVD_BOOTSTRAP}" ]
then
git add ${GVD_VERSION_FNAME}
fi
git config user.name "GitHub Actions"
git config user.email "actions@users.noreply.github.com"
git commit -am "Automated release for version \"${GVD_VERSION}\""
git push
- name: "perform release"
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
tag_name: ${{ env.GVD_VERSION }}