forked from Minestom/Minestom
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (73 loc) · 2.76 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (73 loc) · 2.76 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
name: Release
on:
workflow_dispatch: { }
permissions:
contents: write # Required to create tags
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with: # We have to fetch full history because we need old tags
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: graalvm
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Gradle pre-run
run: ./gradlew determineMinecraftVersion --no-configuration-cache
- id: version
name: Determine Version
run: |
DATE=$(date +'%Y.%m.%d')
MC_VERSION=$(./gradlew determineMinecraftVersion --quiet --console=plain --no-configuration-cache)
TAGS=$(git tag --list "${DATE}*")
echo "Existing tags: $TAGS"
if [ -z "$TAGS" ]; then
VERSION="$DATE-$MC_VERSION"
else
SUFFIXES=$(echo "$TAGS" | sed -n "s/^$DATE\([a-z]\)\-.*$/\1/p")
NEXT_SUFFIX="b"
if [ -n "$SUFFIXES" ]; then
LAST_SUFFIX=$(echo "$SUFFIXES" | sort | tail -n1)
NEXT_SUFFIX=$(printf "\\$(printf '%03o' $(( $(printf '%d' "'$LAST_SUFFIX") + 1 )) )")
fi
VERSION="${DATE}${NEXT_SUFFIX}-$MC_VERSION"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Version: ${VERSION}" >> $GITHUB_STEP_SUMMARY
- name: Build javadoc
run: ./gradlew javadoc
env:
MINESTOM_VERSION: ${{ steps.version.outputs.version }}
- name: Publish to Maven Central
if: github.repository_owner == 'Minestom'
run: ./gradlew publishAggregationToCentralPortal
env:
MINESTOM_VERSION: ${{ steps.version.outputs.version }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
- name: Deploy javadoc to its assigned branch
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: javadoc
FOLDER: build/docs/javadoc
SKIP_EMPTY_COMMITS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLEAR_GLOBS_FILE: ".github/javadoc-publish-clear"
- name: Create Tag
run: |
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
generate_release_notes: true