Skip to content

Commit

Permalink
clean, add auto upload
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Sep 17, 2023
1 parent 7d0e5c4 commit 1412799
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
name: Gradle Build

on: [push, pull_request]
on:
workflow_dispatch:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
strategy:
matrix:
java: [ 20 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 20
uses: actions/setup-java@v2
- uses: actions/checkout@v3
with:
java-version: 20
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'

- name: Build with Gradle
run: ./gradlew build
uses: gradle/gradle-build-action@v2
with:
arguments: build --parallel --stacktrace
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/heads/dev/') && !startsWith(github.ref, 'refs/tags/v') }}

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Artifacts
path: ./build/libs/
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Release

on: [workflow_dispatch] # Manual trigger

permissions:
contents: write

jobs:
Build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 20
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 20
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }}
- uses: gradle/wrapper-validation-action@v1
- run: |
chmod +x gradlew
./gradlew build publishCurseForge publish modrinth --stacktrace -Porg.gradle.parallel.threads=4
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

0 comments on commit 1412799

Please sign in to comment.