-
Notifications
You must be signed in to change notification settings - Fork 70
71 lines (58 loc) · 2.08 KB
/
build-upload-release.yml
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
name: Build and Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
# Build Step
- name: Run Gradle Build
run: |
if [ "${{ github.event_name }}" == "release" ]; then
VERSION=${{ github.event.release.tag_name }}
VERSION=${VERSION#v} # Strip 'v' if present
./gradlew clean build -Pversion=$VERSION
else
./gradlew clean build
fi
- name: Upload Artifact to GitHub Release
if: ${{ github.event_name == 'release' }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/libs/OldCombatMechanics.jar
asset_name: OldCombatMechanics-${{ github.event.release.tag_name }}.jar
asset_content_type: application/java-archive
- name: Read game versions from gradle.properties
run: |
GAME_VERSIONS=$(grep ^gameVersions gradle.properties | cut -d'=' -f2-)
echo "GAME_VERSIONS=$GAME_VERSIONS" >> $GITHUB_ENV
- name: Upload to dev.bukkit.org
if: ${{ github.event_name == 'release' }}
uses: benwoo1110/dbo-upload-action@main
with:
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
project_id: '98233'
changelog: ${{ github.event.release.body }}
changelog_type: markdown
display_name: OldCombatMechanics ${{ github.event.release.tag_name }}
game_versions: ${{ env.GAME_VERSIONS }}
release_type: 'release'
file_path: './build/libs/OldCombatMechanics.jar'
- name: Publish to Hangar
env:
HANGAR_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
HANGAR_CHANGELOG: ${{ github.event.release.body }}
run: ./gradlew build publishPluginPublicationToHangar --stacktrace