forked from Funwayguy/BetterQuesting
-
Notifications
You must be signed in to change notification settings - Fork 25
61 lines (52 loc) · 1.88 KB
/
github_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
# Creates a release on GitHub with a new tag of the current version
name: Release to GitHub
on:
workflow_dispatch:
inputs:
label:
description: 'Prepended Label'
required: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get Mod Version
id: get_version
run: echo ::set-output name=version::$(sed -n 's/^modVersion = \(.*\)/\1/p' < gradle.properties*)
- name: Get Previous tag
id: previous_tag
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
# exit CI early as a failure if creating this release clashes with the previous version
- name: Check if Version Bump is Needed
if: ${{ format('v{0}', steps.get_version.outputs.version) == (steps.previous_tag.outputs.release) }}
uses: actions/github-script@v6
with:
script: core.setFailed("A version bump from ${{ steps.previous_tag.outputs.release }} is required!")
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Use Cached Gradle Packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties*') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get_version.outputs.version }}
files: build/libs/*.jar
body: "**${{ github.event.inputs.label }}**\n"
generate_release_notes: true