-
Notifications
You must be signed in to change notification settings - Fork 5
96 lines (91 loc) · 3.99 KB
/
Copy pathrelease.yml
File metadata and controls
96 lines (91 loc) · 3.99 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
88
89
90
91
92
93
94
95
96
# Performs all releases using a multipart approach
name: release
env:
PROJECT_NAME: GraphLib
JAVADOC_DIR: com/kneelawk/graphlib/graphlib-javadoc-xplat
MAVEN_IDENTIFIER: 'com.kneelawk.graphlib:graphlib-core-xplat-intermediary'
ROLE_ID: '1239437674058879047'
# Variant: github, maven+javadoc, discord
# Changes:
# 2023-04-22 - Kneelawk: Added changes & variant comments. Fixed Grab CF File ID task name. Renamed build job to
# build-release. Reformatted.
# 2023-04-22 - Kneelawk: Fix references to build job to point to build-release job.
# 2023-04-22 - Kneelawk: Copy gradle caches to prevent re-building in publishing jobs.
# 2023-05-02 - Kneelawk: Added javadoc publishing. Added maven job step for getting proper tag version by removing 'v'.
# 2023-05-08 - Kneelawk: Combined maven and javadoc steps.
# 2023-05-10 - Kneelawk: Copy all javadoc directories in the docs directory.
# 2023-05-10 - Kneelawk: Use regular publish gradle task.
# 2023-12-12 - Kneelawk: Switch back to single-job system to avoid uploading massive artifacts.
on:
push:
tags:
# matches things like v0.3.3+1.18.2
- 'v[0-9]+.[0-9]+.[0-9]+\+[0-9]+.[0-9]+.[0-9]+'
# matches things like v0.4.0+1.19
- 'v[0-9]+.[0-9]+.[0-9]+\+[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew
- name: Build
run: ./gradlew build
env:
RELEASE_TAG: ${{ github.ref_name }}
- name: Capture Build Directory
uses: actions/upload-artifact@v4
with:
name: build-dir
path: build/
- name: Github Release
uses: softprops/action-gh-release@v2
with:
body_path: changelogs/changelog-${{ github.ref_name }}.md
files: build/libs/*
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
- name: Maven Release
run: ./gradlew publish -PkneelawkUsername=${{ secrets.MAVEN_USERNAME }} -PkneelawkPassword=${{ secrets.MAVEN_PASSWORD }}
env:
RELEASE_TAG: ${{ github.ref_name }}
# This is the mess that publishes discord notifications
- name: Read Changelog File
uses: juliangruber/read-file-action@v1
id: changelog
with:
path: changelogs/changelog-${{ github.ref_name }}.md
- name: Process Changelog for Announcement
uses: actions/github-script@v7
id: announcement_text
env:
CHANGELOG: ${{ steps.changelog.outputs.content }}
TAG_VERSION: ${{ github.ref_name }}
with:
script: |
let fullVersion = process.env.TAG_VERSION;
let versions = fullVersion.split('+');
let mavenVersion = fullVersion.substring(1);
let lines = process.env.CHANGELOG.split('\n');
let changesStart = lines.findIndex(line => line.startsWith('*'));
lines.splice(0, changesStart);
lines.unshift(`# ${process.env.PROJECT_NAME} Release`, `**<@&${process.env.ROLE_ID}> ${process.env.PROJECT_NAME} ${versions[0]} has been released for Minecraft ${versions[1]}!**`, '', '__Changes:__');
lines.push("Available on Kneelawk's maven: https://maven.kneelawk.com/releases/", `With the identifier: \`${process.env.MAVEN_IDENTIFIER}:${mavenVersion}\``);
lines.push(`Javadoc available at: https://maven.kneelawk.com/javadoc/releases/${process.env.JAVADOC_DIR}/${mavenVersion}`);
return lines.join('\n');
result-encoding: string
- name: Make Release Announcement
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: ${{ steps.announcement_text.outputs.result }}