Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 9917d38

Browse files
committed
Merge branch '1.17' into 1.16
# Conflicts: # .github/workflows/publish.yml # build.gradle # gradle.properties # src/main/kotlin/xyz/deathsgun/modmanager/ModManager.kt # src/main/resources/fabric.mod.json # src/main/resources/modmanager.mixins.json
2 parents 3e73a16 + 24dcf85 commit 9917d38

File tree

8 files changed

+171
-30
lines changed

8 files changed

+171
-30
lines changed

.github/workflows/build.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- "1.16"
6+
- "1.17"
7+
- "1.18"
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
outputs:
14+
version: ${{ steps.properties.outputs.version }}
15+
changelog: ${{ steps.properties.outputs.changelog }}
16+
steps:
17+
18+
# Check out current repository
19+
- name: Fetch Sources
20+
uses: actions/checkout@v2.4.0
21+
22+
# Validate wrapper
23+
- name: Gradle Wrapper Validation
24+
uses: gradle/wrapper-validation-action@v1.0.4
25+
26+
# Setup Java 11 environment for the next steps
27+
- name: Setup Java
28+
uses: actions/setup-java@v2
29+
with:
30+
distribution: zulu
31+
java-version: 17
32+
cache: gradle
33+
34+
# Set environment variables
35+
- name: Export Properties
36+
id: properties
37+
shell: bash
38+
run: |
39+
PROPERTIES="$(./gradlew properties --console=plain -q)"
40+
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
41+
TARGET="$(echo "$PROPERTIES" | grep "^release_target:" | cut -f2- -d ' ')"
42+
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
43+
CHANGELOG="${CHANGELOG//'%'/'%25'}"
44+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
45+
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
46+
echo "::set-output name=version::$VERSION"
47+
echo "::set-output name=changelog::$CHANGELOG"
48+
49+
- name: Build artifact
50+
run: ./gradlew build zip
51+
52+
- name: Publish Unit Test Results
53+
uses: EnricoMi/publish-unit-test-result-action@v1
54+
if: always()
55+
with:
56+
files: build/test-results/**/*.xml
57+
58+
- name: Collect Artifact
59+
uses: actions/upload-artifact@v2.2.4
60+
with:
61+
path: ./build/distributions/*.zip
62+
63+
releaseDraft:
64+
name: Release Draft
65+
if: github.event_name != 'pull_request'
66+
needs: build
67+
runs-on: ubuntu-latest
68+
steps:
69+
70+
# Check out current repository
71+
- name: Fetch Sources
72+
uses: actions/checkout@v2.4.0
73+
74+
# Remove old release drafts by using the curl request for the available releases with draft flag
75+
- name: Remove Old Release Drafts
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: |
79+
gh api repos/{owner}/{repo}/releases \
80+
--jq '.[] | select(.draft == true) | select(.target_commitish=="${{ needs.build.outputs.target }}") | .id' \
81+
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
82+
# Create new release draft - which is not publicly visible and requires manual acceptance
83+
- name: Create Release Draft
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
run: |
87+
gh release create v${{ needs.build.outputs.version }} \
88+
--draft \
89+
--title "v${{ needs.build.outputs.version }}" \
90+
--notes "$(cat << 'EOM'
91+
${{ needs.build.outputs.changelog }}
92+
EOM
93+
)"

.github/workflows/publish.yml

Lines changed: 71 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,77 @@
1-
name: Publish to Modrinth
1+
name: Release
22
on:
3-
push:
4-
tags:
5-
- v*
3+
release:
4+
types: [ prereleased, released ]
65

76
jobs:
8-
build:
9-
strategy:
10-
matrix:
11-
java: [
12-
1.8
13-
]
14-
os: [ ubuntu-latest ]
15-
runs-on: ${{ matrix.os }}
7+
8+
# Prepare and publish the mod to the modrinth
9+
release:
10+
name: Publish Plugin
11+
runs-on: ubuntu-latest
1612
steps:
17-
- name: checkout repository
18-
uses: actions/checkout@v2
19-
- name: validate gradle wrapper
20-
uses: gradle/wrapper-validation-action@v1
21-
- name: setup jdk ${{ matrix.java }}
22-
uses: actions/setup-java@v1
13+
14+
# Check out current repository
15+
- name: Fetch Sources
16+
uses: actions/checkout@v2.4.0
17+
with:
18+
ref: ${{ github.event.release.tag_name }}
19+
20+
# Setup Java 1.8 environment for the next steps
21+
- name: Setup Java
22+
uses: actions/setup-java@v2
2323
with:
24-
java-version: ${{ matrix.java }}
25-
- name: make gradle wrapper executable
26-
run: chmod +x ./gradlew
27-
- name: build
28-
run: ./gradlew build
29-
- name: Publish artifacts to Modrinth
24+
java-version: 1.8
25+
cache: gradle
26+
27+
# Set environment variables
28+
- name: Export Properties
29+
id: properties
30+
shell: bash
31+
run: |
32+
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
33+
${{ github.event.release.body }}
34+
EOM
35+
)"
36+
37+
CHANGELOG="${CHANGELOG//'%'/'%25'}"
38+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
39+
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
40+
echo "::set-output name=changelog::$CHANGELOG"
41+
# Update Unreleased section with the current release note
42+
- name: Patch Changelog
43+
if: ${{ steps.properties.outputs.changelog != '' }}
44+
env:
45+
CHANGELOG: ${{ steps.properties.outputs.changelog }}
46+
run: |
47+
./gradlew patchChangelog --release-note="$CHANGELOG"
48+
# Publish the mod to Modrinth
49+
- name: Publish Plugin
50+
env:
51+
MODRINTH: ${{ secrets.MODRINTH }}
3052
run: ./gradlew publishModrinth
53+
54+
# Upload artifact as a release asset
55+
- name: Upload Release Asset
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
59+
60+
# Create pull request
61+
- name: Create Pull Request
62+
if: ${{ steps.properties.outputs.changelog != '' }}
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
run: |
66+
VERSION="${{ github.event.release.tag_name }}"
67+
BRANCH="changelog-update-$VERSION"
68+
git config user.email "action@github.com"
69+
git config user.name "GitHub Action"
70+
git checkout -b $BRANCH
71+
git commit -am "Changelog update - $VERSION"
72+
git push --set-upstream origin $BRANCH
73+
gh pr create \
74+
--title "Changelog update - \`$VERSION\`" \
75+
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
76+
--base main \
77+
--head $BRANCH

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Test commit
2-
on: [ push ]
2+
on: [ pull_request ]
33

44
jobs:
55
build:

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- Update all button. Update all your mods in one go! [#100](https://github.com/DeathsGun/ModManager/issues/100)
8+
- Support for 1.16
89

910
### Fixed
1011

@@ -16,7 +17,7 @@
1617
- Updated to 1.18.1
1718
- Updated Russian translation (thanks to Felix14-v2) [#97](https://github.com/DeathsGun/ModManager/pull/97)
1819

19-
## [1.2.1] - 22.11.2021
20+
## [1.2.0+1.18-pre] - 22.11.2021
2021

2122
### Added
2223

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ plugins {
2020
id "fabric-loom" version "0.7-SNAPSHOT"
2121
id "com.modrinth.minotaur" version "1.2.1"
2222
id "org.jetbrains.kotlin.jvm" version "1.5.30"
23+
id "org.jetbrains.changelog" version "1.3.1"
2324
id "org.jetbrains.kotlin.plugin.serialization" version "1.5.30"
2425
}
2526

@@ -110,5 +111,5 @@ task publishModrinth(type: TaskModrinthUpload) {
110111
addLoader("fabric")
111112
addDependency("E4QBMVtO", Dependency.DependencyType.REQUIRED) // Mod Menu
112113
addDependency("1qsZV7U7", Dependency.DependencyType.REQUIRED) // fabric-language-kotlin
113-
changelog = file("CHANGELOG.md").getText("UTF-8")
114+
changelog = this.changelog.getUnreleased().withHeader(false).toText()
114115
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ minecraft_version=1.16.5
2121
yarn_mappings=1.16.5+build.10
2222
loader_version=0.12.5
2323
# Mod Properties
24-
mod_version=1.2.0+1.16
24+
mod_version=1.2.1+1.16
2525
maven_group=xyz.deathsgun
2626
archives_base_name=modmanager
2727
# Dependencies

src/main/kotlin/xyz/deathsgun/modmanager/ModManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ModManager : ClientModInitializer {
5757
@JvmStatic
5858
fun getVersion(): String {
5959
return FabricLoader.getInstance().allMods.find { it.metadata.id.equals("modmanager") }
60-
?.metadata?.version?.friendlyString ?: "2.0.0+1.16"
60+
?.metadata?.version?.friendlyString ?: "1.2.1+1.16"
6161
}
6262

6363
@JvmStatic

src/test/kotlin/xyz/deathsgun/modmanager/providers/modrinth/ModrinthTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ internal class ModrinthTest {
127127
assertTrue(mod.slug.isNotEmpty())
128128
assertTrue(mod.name.isNotEmpty())
129129
assertNull(mod.author)
130-
assertNotNull(mod.iconUrl)
131130
assertTrue(mod.shortDescription.isNotEmpty())
132131
assertTrue(mod.categories.isNotEmpty())
133132
assertNotNull(mod.description)

0 commit comments

Comments
 (0)