Skip to content

Commit

Permalink
Update build scripts and workflow actions
Browse files Browse the repository at this point in the history
 - build script change and especially workflow actions changes were
   based from https://github.com/CaffeineMC/sodium-fabric/tree/404151901893ad2cfdac91411b86e1e284d904c6/.github/workflows
  • Loading branch information
StartsMercury committed May 18, 2024
1 parent 9c589d6 commit 99925d5
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 201 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: build-commit
on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract Current Branch Name
shell: bash
# bash pattern expansion to grab the branch name without the slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref

- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle Build
run: ./gradle build

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: simply-no-shading-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
26 changes: 26 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: build-pull-request
on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle Build
run: ./gradle build
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
name: Publish
name: build-release
on:
release:
types: [published]
types:
- published

jobs:
build:
runs-on: ubuntu-latest

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

steps:
- name: Checkout repository
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v3

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Make gradle wrapper executable
cache: gradle

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Build
run: ./gradlew clean -Pversion=${{ github.ref_name }} build --stacktrace
- name: Upload binaries to release
run: ./gradlew clean build -Pbuild.release=true

- name: Upload Binaries to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/*
file: 'build/libs/*.jar;LICENSE'
file_glob: true
- uses: Kir-Antipov/[email protected]

- name: Upload Binaries to Modrinth
uses: Kir-Antipov/[email protected]
with:
modrinth-id: 9gx5Xvc5
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: build-tag
on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract Current Branch Name
shell: bash
# bash pattern expansion to grab the branch name without the slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref

- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle Build
run: ./gradlew build -Pbuild.release=true

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: simply-no-shading-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/pull_build.yml

This file was deleted.

Loading

0 comments on commit 99925d5

Please sign in to comment.