-
Notifications
You must be signed in to change notification settings - Fork 30
56 lines (49 loc) · 1.51 KB
/
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
name: Publish GitHub Release
on:
push:
# Only release tags on the main branch
branches:
- 'main'
tags:
- 'v*' # e.g. v1.2.3
- '!v*[+]mc*' # exclude tags handled by publish.yaml
# Only allow running one build job at a time to optimise cache hits
concurrency:
group: builds
# Grant permission to create/update releases
permissions:
contents: write
env:
TAG: ${{ github.ref_name }}
jobs:
release:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Get release
id: get
run: |
if gh api /repos/{owner}/{repo}/releases/tags/"$TAG" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
> /dev/null
then
echo "found=true"
else
echo "found=false"
fi
# TODO create a release with the same title & body that modpublisher would use
#
# Note: modpublisher currently won't edit these when updating an existing release...
# TODO: add support for that upstream?
- name: Create release
if: ${{ steps.get.outputs.found == 'true' }}
run: |
gh release create "$TAG" --draft="false" \
--title "TODO" \
--notes "TODO"
# If the release exists, publish it by setting draft=false
- name: Update release
if: ${{ steps.get.outputs.found == 'false' }}
run: gh release edit "$TAG" --draft="false"