This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
Merge pull request #50 from Subtixx/dependabot/gradle/org.jetbrains.k… #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "main", "develop", "release/*" ] | |
pull_request: | |
branches: [ "main", "develop", "release/*" ] | |
release: | |
types: [ created ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4.3.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4.1.0 | |
with: | |
gradle-version: '8.8' | |
cache-overwrite-existing: true | |
- name: Build with Gradle | |
run: gradle build | |
env: | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4.4.0 | |
with: | |
name: jar | |
path: build/libs/omnicraft-*.jar | |
- uses: actions/upload-artifact@v4.4.0 | |
with: | |
name: build | |
path: . | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: read | |
packages: read | |
security-events: write | |
actions: read | |
steps: | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: java-kotlin | |
- name: Download artifact | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: build | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4.3.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4.1.0 | |
with: | |
gradle-version: '8.8' | |
cache-overwrite-existing: true | |
- name: Run detekt | |
run: gradle detekt | |
env: | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
- name: Upload SARIF to GitHub using the upload-sarif action | |
uses: github/codeql-action/upload-sarif@v3 | |
if: success() || failure() | |
with: | |
sarif_file: build/reports/detekt/detekt.sarif | |
- name: Upload Reports | |
uses: actions/upload-artifact@v4.4.0 | |
with: | |
name: reports | |
path: build/reports | |
- name: Test with Gradle | |
run: gradle test | |
env: | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
- name: Delete shared artifact | |
uses: geekyeggo/delete-artifact@v5.1.0 | |
with: | |
name: build | |
publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref_name, 'release/') | |
needs: build | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4.3.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4.1.0 | |
with: | |
gradle-version: '8.8' | |
cache-overwrite-existing: true | |
- name: Download artifact | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: build | |
- name: Publish to Modrinth | |
uses: Kir-Antipov/mc-publish@v3.3 | |
with: | |
modrinth-id: omni-craft | |
modrinth-featured: true | |
modrinth-unfeature-mode: subset | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
#curseforge-id: 394468 | |
#curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
publish-release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref_name, 'release/') | |
needs: build | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Update CHANGELOG | |
id: changelog | |
uses: requarks/changelog-action@v1 | |
with: | |
token: ${{ github.token }} | |
tag: ${{ github.ref_name }} | |
- name: Create Release | |
uses: ncipollo/release-action@v1.14.0 | |
with: | |
allowUpdates: true | |
draft: false | |
makeLatest: true | |
name: ${{ github.ref_name }} | |
body: ${{ steps.changelog.outputs.changes }} | |
token: ${{ github.token }} | |
artifacts: jar | |
- name: Commit CHANGELOG.md | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: main | |
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' | |
file_pattern: CHANGELOG.md |