-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (101 loc) · 3.25 KB
/
Copy pathbuild.yml
File metadata and controls
117 lines (101 loc) · 3.25 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
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
116
117
name: Build Mod
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
workflow_dispatch:
inputs:
version:
description: 'Версия релиза (например: 1.0.0)'
required: true
type: string
release_notes:
description: 'Описание релиза'
required: false
default: 'Новый релиз'
type: string
publish_modrinth:
description: 'Залить на Modrinth?'
required: false
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --no-daemon
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: CameraAPI-${{ github.sha }}
path: build/libs/*.jar
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --no-daemon
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ github.event.inputs.version }}
name: CameraAPI v${{ github.event.inputs.version }}
body: ${{ github.event.inputs.release_notes }}
files: build/libs/*.jar
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Publish to Modrinth
if: github.event.inputs.publish_modrinth == 'true'
uses: Kir-Antipov/mc-publish@v3.3
with:
modrinth-id: ${{ secrets.MODRINTH_PROJECT_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
files: build/libs/*.jar
name: CameraAPI v${{ github.event.inputs.version }}
version: ${{ github.event.inputs.version }}
version-type: release
changelog: ${{ github.event.inputs.release_notes }}
loaders: forge
game-versions: 1.20.1