Skip to content

Commit a016f5e

Browse files
committed
自动构建
1 parent b7eb074 commit a016f5e

3 files changed

Lines changed: 86 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build mod
2+
3+
on: [ push, pull_request, workflow_dispatch ]
4+
5+
jobs:
6+
build:
7+
name: Build mod
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v2
14+
with:
15+
distribution: 'adopt'
16+
java-version: '17'
17+
- name: Grant execute permission for gradlew
18+
run: chmod +x gradlew
19+
- name: Build with Gradle
20+
run: ./gradlew -Pnet.minecraftforge.gradle.disableUpdateChecker=true build
21+
- name: Upload artifacts
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: Random Complement
25+
path: build/libs

.github/workflows/deploy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# A deployment template that works out of the box
2+
# It supports these objectives:
3+
# - Deploy to Maven (Build Job) [Secrets: MAVEN_USER, MAVEN_PASS]
4+
# - Deploy to CurseForge (Upload Job) [Secrets: CURSEFORGE_TOKEN]
5+
# - Deploy to Modrinth (Upload Job) [Secrets: MODRINTH_TOKEN]
6+
7+
name: Deploy
8+
9+
on:
10+
push:
11+
tags:
12+
- '[0-9]+.[0-9]+.[0-9]+'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Repository
19+
uses: actions/checkout@v3
20+
21+
- name: Grant Execute Permission for gradlew
22+
run: chmod +x gradlew
23+
24+
- name: Read gradle.properties
25+
uses: BrycensRanch/read-properties-action@v1
26+
id: properties
27+
with:
28+
file: gradle.properties
29+
all: true
30+
31+
- name: Setup Java
32+
uses: actions/setup-java@v3
33+
with:
34+
java-version: '17'
35+
distribution: 'zulu'
36+
cache: gradle
37+
38+
- name: Publish to Maven
39+
if: steps.properties.outputs.publish_to_maven == 'true' && steps.properties.outputs.publish_to_local_maven == 'true'
40+
uses: gradle/gradle-build-action@v2
41+
with:
42+
arguments: |
43+
publish
44+
-P${{ steps.properties.outputs.maven_name }}Username=${{ secrets.MAVEN_USER }}
45+
-P${{ steps.properties.outputs.maven_name }}Password=${{ secrets.MAVEN_PASS }}
46+
47+
- name: Publish to CurseForge
48+
if: steps.properties.outputs.publish_to_curseforge == 'true'
49+
uses: gradle/gradle-build-action@v2
50+
env:
51+
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
52+
with:
53+
arguments: curseforge
54+
55+
- name: Publish to Modrinth
56+
if: steps.properties.outputs.publish_to_modrinth == 'true'
57+
uses: gradle/gradle-build-action@v2
58+
env:
59+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
60+
with:
61+
arguments: modrinth

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,3 @@ gradle-app.setting
113113

114114
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
115115
!gradle-wrapper.jar
116-
/.github/

0 commit comments

Comments
 (0)