-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (56 loc) · 2.55 KB
/
publish.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
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+.?[0-9]*" # Push events to matching v*, v20.15.10.1
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" # Push events to matching alpha releases
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" # Push events to matching beta releases
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" # Push events to matching release candidates
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Declare Commit Variables
id: is_pre_release
shell: bash
run: |
echo "::set-output name=IS_PRE_RELEASE::$(echo "${{ steps.get_version.outputs.VERSION }}" | awk 'BEGIN{prerelease="false"} /beta|alpha/{prerelease="true"} END{print prerelease}')"
- name: Set Release Type
id: release_type
shell: bash
run: |
echo "::set-output name=RELEASE_TYPE::$(echo "${{ steps.get_version.outputs.VERSION }}" | awk 'BEGIN{release_type="release"} /beta|alpha/{release_type="alpha"} END{print release_type}')"
- name: Set File Name
id: file_name
shell: bash
run: |
echo "::set-output name=FILE_NAME::$(echo randomloot-$(echo "${{ steps.get_version.outputs.VERSION }}" | grep -o '[0-9]*\.[0-9]*\.[0-9]*').jar)"
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ steps.is_pre_release.outputs.IS_PRE_RELEASE }}
files: "build/libs/*.jar"
- name: Upload to CurseForge
uses: itsmeow/[email protected]
with:
file_path: "build/libs/${{ steps.file_name.outputs.FILE_NAME }}"
game_endpoint: "minecraft"
game_versions: "Minecraft 1.20:1.20.1,Java 17,Forge"
token: "${{ secrets.CurseForge }}"
project_id: "301631"
display_name: "Random Loot 2 - ${{ steps.get_version.outputs.VERSION }}"
release_type: ${{ steps.release_type.outputs.RELEASE_TYPE }}