forked from GregTechCEu/GregTech
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.98 KB
/
github_release.yml
File metadata and controls
63 lines (53 loc) · 1.98 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
# Creates a release on GitHub with a new tag of the current version
name: Release to GitHub
on:
workflow_dispatch:
inputs:
label:
description: 'Release Label'
default: 'BETA RELEASE'
required: false
hotfix:
description: 'Hotfix Release'
required: false
type: boolean
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Fetch Git Tags
run: git fetch --prune --unshallow --tags
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-executable: ".gradlew"
generate-job-summary: false
- name: Get Current Mod Version
id: get_current_version
run: echo ::set-output name=version::$(echo "$(./gradlew getVersionFromJava --q | sed -E 's/1.12.2-|-.+//g')" > ver.txt && cat ver.txt)
- name: Get Latest Tag
id: get_latest_tag
run: echo ::set-output name=version::$(git describe --tags --abbrev=0)
# exit CI early as a failure if creating this release clashes with the previous version
- name: Check Build Versions
if: ${{ (steps.get_latest_tag.outputs.version) == format('v{0}', steps.get_current_version.outputs.version) }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('A version bump from ${{ steps.get_latest_tag.outputs.latest }} is required!')
- name: Execute Gradle build
run: ./gradlew build
- name: Create GitHub Release
uses: softprops/[email protected]
with:
tag_name: v${{ steps.get_current_version.outputs.version }}
files: build/libs/*.jar
body: "**${{ github.event.inputs.label }}${{ inputs.hotfix && ' (HOTFIX)' || '' }}**\n"
generate_release_notes: true