Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add artifacts #3

Merged
merged 5 commits into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 85 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,95 @@
name: build
on: [pull_request, push]
name: Java CI with Gradle

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:

strategy:
matrix:
minecraft: [1.16.5, 1.17.1, 1.18.2, 1.19.2, 1.19.4, 1.20.1, 1.20.4]
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Setup Forge files
run: ./gradlew forge:setupFiles -Pminecraft_version="${{ matrix.minecraft }}"
- name: Build with Gradle
run: |
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2

- name: Make Gradle wrapper executable
run: chmod +x gradlew

- name: Setup Forge files
run: ./gradlew forge:setupFiles -Pminecraft_version="${{ matrix.minecraft }}"

- name: Build with Gradle Wrapper
run: |
NOW=$(date '+%Y-%m-%d-%H.%M')
./gradlew build -Pminecraft_version="${{ matrix.minecraft }}" -Partifact_date=".artifact_$NOW"

# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2
# with:
# gradle-version: '8.5'
#
# - name: Build with Gradle 8.5
# run: gradle build
- name: Delete temp files
run: exit 0
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
# Artifact name
name: Mod File (${{ matrix.minecraft }})
# A file, directory or wildcard pattern that describes what to upload
path: build
# The desired behavior if no files are found using the provided path.
if-no-files-found: error
- name: Upload a Build Artifact (Resources)
if: false
uses: actions/upload-artifact@v4
with:
# Artifact name
name: Resource File (${{ matrix.minecraft }})
# A file, directory or wildcard pattern that describes what to upload
path: build/resources
# The desired behavior if no files are found using the provided path.
if-no-files-found: warn

dependency-submission:

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2
Loading