-
Notifications
You must be signed in to change notification settings - Fork 93
60 lines (51 loc) · 1.61 KB
/
pre-release.yaml
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
name: Create Pre-Release
on:
workflow_dispatch:
inputs:
commit:
description: 'Release commit'
required: true
permissions:
contents: write
jobs:
pre-release:
name: Pre-release
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Determine minor version
id: tag-setter
run: |
DATE=$(date +"%Y.%m.%d")
PREV_RELEASE=$(git tag --list | tail -1)
PREV_DATE="${PREV_RELEASE%.*}"
MINOR_VERSION=0
case $PREV_DATE in
*"$DATE"*)
MINOR_VERSION=${PREV_RELEASE##*.}
MINOR_VERSION=$((MINOR_VERSION+1))
;;
*)
MINOR_VERSION=0
;;
esac
echo "TAG_VERSION=r.$DATE.$MINOR_VERSION" >> $GITHUB_ENV
- name: Set the release commit
run: echo "RELEASE_COMMIT=${{ github.event.inputs.commit }}" >> $GITHUB_ENV
- name: Create release body file
run: bash .github/scripts/get_description.sh
- name: Set release body
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
bodyFile: release_body.md
commit: ${{ github.event.inputs.commit }}
prerelease: true
tag: ${{ env.TAG_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}