-
Notifications
You must be signed in to change notification settings - Fork 5
67 lines (57 loc) · 1.73 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
67
name: ci-release
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
if: "github.repository_owner == 'SciTools'"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
WF_VERSION_FNAME: "version.txt"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "calculate release version"
run: |
git pull
if [ -f "${WF_VERSION_FNAME}" ]
then
WF_VERSION=$(cat ${WF_VERSION_FNAME})
WF_DATE=$(echo ${WF_VERSION} | cut -d. -f1-2)
WF_SERIAL=$(echo ${WF_VERSION} | cut -d. -f3)
NOW_DATE=$(date +%Y.%m)
NOW_SERIAL=0
if [ "${WF_DATE}" == "${NOW_DATE}" ]
then
NOW_SERIAL=$(expr ${WF_SERIAL} + 1)
fi
WF_VERSION="${NOW_DATE}.${NOW_SERIAL}"
else
WF_VERSION="$(date +%Y.%m).0"
echo "WF_BOOTSTRAP=1" >> ${GITHUB_ENV}
fi
echo "WF_VERSION=${WF_VERSION}" >> ${GITHUB_ENV}
- name: "store release version"
run: |
echo ${{ env.WF_VERSION }} > ${WF_VERSION_FNAME}
if [ -n "${WF_BOOTSTRAP}" ]
then
git add ${WF_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 \"${WF_VERSION}\""
git push
- name: "perform release"
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048
with:
tag_name: ${{ env.WF_VERSION }}