Skip to content

Build #398

Build #398 #398

Workflow file for this run

name: Build
run-name: "Build #${{ github.run_number }}"
on:
push:
tags:
- 'v*'
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
get-changelog:
name: Get Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Changelog
shell: bash
run: |
latest_tag=$(git describe --tags --abbrev=0)
{ grep --color=auto -Pzo "(?<=## $latest_tag)((?!\n## )[\s\S])*" ./CHANGELOG.md || true; } | sed '$ s/.$//' > ./NEW_CHANGELOG.md
- name: Upload Changelog
uses: actions/upload-artifact@v4
with:
name: changelog
path: ${{ github.workspace }}/NEW_CHANGELOG.md
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- run: ./gradlew jvmTest --stacktrace
- name: Upload the build report
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-report
path: '**/build/reports'
build-jvm-jar:
name: Build JVM Jar
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: 📦 Build JVM Jar
run: ./gradlew jvmJar
env:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
- name: Upload JVM Jar
uses: actions/upload-artifact@v4
with:
name: jvm-jar
path: build/libs/pakku.jar
build-jvm-dist-zip:
name: Build JVM ZIP Distribution
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: 📦 Build JVM distZip
run: ./gradlew distZip
env:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
- name: Upload JVM ZIP Distribution
uses: actions/upload-artifact@v4
with:
name: jvm-dist-zip
path: build/distributions/*.zip
build-jvm-dist-tar:
name: Build JVM Tar Distribution
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: 📦 Build JVM distTar
run: ./gradlew distTar
env:
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
- name: Upload JVM Tar Distribution
uses: actions/upload-artifact@v4
with:
name: jvm-dist-tar
path: build/distributions/
release:
name: Release
runs-on: ubuntu-latest
needs: [get-changelog, test, build-jvm-jar, build-jvm-dist-zip, build-jvm-dist-tar]
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download Artifact Changelog
uses: actions/download-artifact@v4
with:
name: changelog
- name: Download Artifact JVM Jar
uses: actions/download-artifact@v4
with:
name: jvm-jar
path: jar
- name: Download Artifact JVM ZIP Distribution
uses: actions/download-artifact@v4
with:
name: jvm-dist-zip
path: dist
- name: Download Artifact JVM Tar Distribution
uses: actions/download-artifact@v4
with:
name: jvm-dist-tar
path: dist
- name: Create release
uses: softprops/action-gh-release@v1
with:
body_path: ./NEW_CHANGELOG.md
prerelease: false
token: ${{ secrets.PUSH_ACCESS_TOKEN }}
files: |
jar/pakku.jar
dist/*.zip
dist/*.tar