Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranCZ committed Jul 26, 2024
2 parents f8a90c6 + 845b1a3 commit 18cbc4b
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will build a Java project with Gradle
# For more information check https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
Expand All @@ -13,35 +10,57 @@ jobs:
build:
runs-on: ubuntu-latest

env:
LATEST_VERSION: "1.21"
INCLUDE_DEVLIBS: "true"

# Warning: Don't add too many versions because it takes a lot of space in the artifacts,
# and I've gotten an email from GitHub about it so please just don't.
VERSIONS_TO_BUILD: "1.16.5 1.17.1 1.18.2 1.20.4 1.21"

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17

- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Create versions directory and mainProject
run: |
mkdir -p ./versions
if [ ! -f ./versions/mainProject ]; then
echo $LATEST_VERSION > ./versions/mainProject
fi
- name: Build with Gradle
run: ./gradlew build

- name: Archive Artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: ./build/libs
- name: Create artifact directory structure
run: |
mkdir -p artifacts
for version in $VERSIONS_TO_BUILD; do
mkdir -p artifacts/$version/libs
cp ./versions/$version/build/libs/*.jar artifacts/$version/libs/
if [ "$INCLUDE_DEVLIBS" = "true" ]; then
mkdir -p artifacts/$version/devlibs
cp ./versions/$version/build/devlibs/*.jar artifacts/$version/devlibs/
fi
done
- name: Hash Artifacts
- name: Compute hashes
run: |
for u in $(ls)
do
echo "$(sha256sum $u)" >> hashes.sha256
touch artifacts/hashes.txt
for jar in $(find artifacts -name '*.jar'); do
sha256sum $jar >> artifacts/hashes.txt
done
shell: bash
working-directory: ./build/libs
- name: Upload Hashes
- name: Archive Artifacts
uses: actions/upload-artifact@v2
with:
name: Hashes
path: ./build/libs/hashes.sha256
name: Artifacts
path: artifacts

0 comments on commit 18cbc4b

Please sign in to comment.