This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (104 loc) · 3.41 KB
/
build.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: build
on:
push:
workflow_dispatch:
inputs:
version_type:
description: "The type of this version. e.g alpha"
type: choice
default: beta
options:
- release
- beta
- alpha
required: false
jobs:
build:
runs-on: ubuntu-latest
if: |
!contains(github.event.head_commit.message, '[ci skip]')
outputs:
version_info: ${{ steps.get_version.outputs.version_info }}
version_plain: ${{ steps.get_version.outputs.version_plain }}
steps:
- name: checkout repository
uses: actions/[email protected]
- name: validate gradle wrapper
uses: gradle/[email protected]
- name: setup jdk
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: get version #https://stackoverflow.com/questions/71089787/how-to-get-version-name-from-android-gradle-file-in-github-actions
id: get_version
run: |
echo "version_info=$(${{github.workspace}}/gradlew -q printVersionName)" >> $GITHUB_OUTPUT
echo "version_plain=$(${{github.workspace}}/gradlew -q printVersion)" >> $GITHUB_OUTPUT
- name: capture build artifacts
uses: actions/[email protected]
with:
name: Artifacts #https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action
path: build/libs/
packages:
needs: build
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/[email protected]
- name: setup jdk
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew publish
publish:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: checkout repository
uses: actions/[email protected]
- uses: actions/[email protected]
with:
name: Artifacts
path: build/libs
- name: publish release
uses: Kir-Antipov/[email protected]
with:
version-type: ${{ inputs.version_type }}
changelog-file: CHANGELOG.md
name: ${{ needs.build.outputs.version_info }}
version: ${{ needs.build.outputs.version_plain }}
game-versions: |
1.20.1
loaders: |
fabric
java: |
17
files: |
build/libs/!(*-@(dev|sources|javadoc|dependencies|full-dependencies)).jar
build/libs/*-@(dev|sources|javadoc).jar
github-tag: v${{ needs.build.outputs.version_plain }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-commitish: ${{ github.sha }}
github-prerelease: false
modrinth-id: 86bUtxWv
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset
modrinth-dependencies: |
fabric-api(required)
dark-matter(embedded)