Repository navigation
68 lines (54 loc) · 1.81 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (54 loc) · 1.81 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
name: Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Read versions from gradle.properties
id: versions
run: |
MC=$(grep -E '^minecraft_version\s*=' gradle.properties \
| sed 's/.*=\s*//' | tr -d '[:space:]')
MOD=$(grep -E '^mod_version\s*=' gradle.properties \
| sed 's/.*=\s*//' | tr -d '[:space:]')
echo "mc=$MC" >> "$GITHUB_OUTPUT"
echo "mod=$MOD" >> "$GITHUB_OUTPUT"
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Build
run: ./gradlew build
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create or move tag
run: |
TAG="v${{ steps.versions.outputs.mc }}-${{ steps.versions.outputs.mod }}-dev"
# Delete local tag if it exists
git tag -d "$TAG" 2>/dev/null || true
# Delete remote tag if it exists
git push origin ":refs/tags/$TAG" 2>/dev/null || true
# Recreate it on the current commit
git tag "$TAG"
git push origin "$TAG" --force
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Upload JAR to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }}
files: build/libs/*.jar
replace_artifacts: true
generate_release_notes: true