forked from pysal/pysal
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.23 KB
/
prerelease.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
name: Create Pre-release
on:
push:
tags:
- '*'
jobs:
create-pre-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if the tag contains 'rc'
id: check_tag
run: |
if [[ "${GITHUB_REF##*/}" == *rc* ]]; then
echo "Tag contains rc"
echo "::set-output name=contains_rc::true"
else
echo "Tag does not contain rc"
echo "::set-output name=contains_rc::false"
fi
- name: Create pre-release
if: steps.check_tag.outputs.contains_rc == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${GITHUB_REF##*/}
RESPONSE=$(curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases \
-d @- << EOF
{
"tag_name": "${TAG_NAME}",
"name": "${TAG_NAME}",
"body": "Pre-release ${TAG_NAME}",
"draft": false,
"prerelease": true
}
EOF
)
echo "$RESPONSE"