forked from Traben-0/Entity_Model_Features
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (71 loc) · 2.35 KB
/
release.yml
File metadata and controls
87 lines (71 loc) · 2.35 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: release-pipeline
on:
push:
tags:
- "v*"
permissions:
issues: write
jobs:
build-release-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: check changelog & version
run: node changelog_test.js
env:
TAG_NAME: ${{ github.ref_name }}
- name: prep discord notification json
run: |
jq --arg ref "$GITHUB_REF_NAME" '.username = "Entity Model Features \($ref) released!"' discord_update.json > tmp.json
mv tmp.json discord_update.json
- name: extract changelog segment
id: extract
run: |
VER="${GITHUB_REF_NAME#v}"
awk -v ver="$VER" '
$0=="[" ver "]" {p=1; next}
/^\[/ && p==1 {p=0}
p==1
' CHANGELOG.MD | sed '/./,$!d' | tac | sed '/./,$!d' | tac > CHANGELOG_SEGMENT.txt
- name: insert extracted text into json
run: |
jq --rawfile seg CHANGELOG_SEGMENT.txt '
.embeds[0].description = $seg
' discord_update.json > tmp.json
mv tmp.json discord_update.json
- name: print discord notification json to be verified before final upload (build will take a while)
run: cat discord_update.json
- name: Make Gradle Wrapper executable
run: chmod +x ./gradlew
- name: Run Gradle build
run: ./gradlew build
- name: upload mod
run: node uploader.js
env:
CF_TOKEN: ${{ secrets.CF_TOKEN }}
CF_COOKIE: ${{ secrets.CF_COOKIE }}
MODRINTH: ${{ secrets.MODRINTH }}
- name: discord notification
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d @discord_update.json \
"$DISCORD_WEBHOOK"
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- name: close labeled issues
run: |
LABEL="Added / Fixed in next release"
ISSUES=$(gh issue list --label "$LABEL" --state open --json number --jq '.[].number')
for i in $ISSUES; do
gh issue close $i
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}