Skip to content

Commit b05e8a6

Browse files
update github workflows
1 parent ec421a2 commit b05e8a6

File tree

3 files changed

+53
-78
lines changed

3 files changed

+53
-78
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,64 @@
11
name: build
2-
on: [pull_request, push]
2+
3+
on: [workflow_dispatch, pull_request, push]
34

45
jobs:
56
build:
6-
runs-on: ubuntu-22.04
7+
runs-on: ubuntu-latest
78
steps:
8-
- name: checkout repository
9+
- name: Checkout repository
910
uses: actions/checkout@v4
10-
- name: validate gradle wrapper
11-
uses: gradle/wrapper-validation-action@v2
12-
- name: setup jdk 21
13-
uses: actions/setup-java@v4
14-
with:
15-
java-version: 21
16-
distribution: 'microsoft'
17-
- name: make gradle wrapper executable
18-
run: chmod +x ./gradlew
19-
- name: build
20-
run: ./gradlew build
2111

22-
# Run script to generate version number env
12+
# Run python script to generate specific changelog and env vars
2313
- name: Set up Python
2414
uses: actions/setup-python@v5
2515
with:
2616
python-version: '3.10'
2717

2818
- name: Run Python script
29-
run: python .github/workflows/release.py
19+
run: python .github/workflows/generate.py
20+
21+
- name: Validate gradle wrapper
22+
uses: gradle/actions/wrapper-validation@v3
23+
24+
- name: Setup JDK ${{env.JAVA_VERSION}}
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: ${{env.JAVA_VERSION}}
28+
distribution: 'microsoft'
29+
30+
- name: Make gradle wrapper executable
31+
run: chmod +x ./gradlew
32+
33+
- name: Build project
34+
run: ./gradlew build
3035

31-
- name: capture build artifacts
36+
- name: Upload build artifacts
3237
uses: actions/upload-artifact@v4
3338
with:
3439
name: bluemap-banners-${{env.VERSION}}
35-
path: build/libs/
40+
path: build/libs/
41+
42+
# Publish release to Modrinth and GitHub, when tag is present
43+
- name: Publish to Modrinth and GitHub
44+
uses: Kir-Antipov/mc-publish@v3.3
45+
if: startsWith(github.ref, 'refs/tags/')
46+
with:
47+
name: "${{env.NAME}}"
48+
version: "v${{env.VERSION}}"
49+
version-type: release
50+
game-versions: "${{env.MINECRAFT_VERSION}}"
51+
loaders: fabric
52+
files: "build/libs/bluemap-banners-${{env.VERSION}}.jar"
53+
54+
# Config for Modrinth
55+
modrinth-id: rx2aSILw
56+
modrinth-token: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
57+
modrinth-changelog-file: modrinth-changelog.md
58+
59+
# Config for GitHub
60+
github-token: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
61+
github-tag: "v${{env.VERSION}}"
62+
github-changelog-file: github-changelog.md
63+
64+
fail-mode: warn
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@
2424
for line in inFile.readlines():
2525
if line.startswith("minecraft_version="):
2626
githubFile.write(f"\nFor Minecraft Version `{line[18:].strip()}`.")
27-
envFile.write(f"\nMINECRAFT_VERSION={line[18:].strip()}")
27+
envFile.write(f"\nMINECRAFT_VERSION={line[18:].strip()}")
28+
29+
with open("build.gradle", "r") as inFile:
30+
for line in inFile.readlines():
31+
if line.startswith(" sourceCompatibility"):
32+
envFile.write(f"\nJAVA_VERSION={line.split("_")[1].strip()}")

.github/workflows/release.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)