CI #157
Workflow file for this run
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, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: 'Validate Gradle wrapper' | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: 'Setup Java' | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'microsoft' | |
java-version: 21 | |
- name: 'Setup Gradle' | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: wrapper | |
cache-read-only: false | |
- name: 'Mark tag as release' | |
if: startsWith(github.ref, 'refs/tags/') | |
run: echo "RELEASE=true" >> $GITHUB_ENV | |
- name: 'Unlock keystore' | |
id: unlock_keystore | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
if: ${{ env.KEYSTORE_BASE64 }} | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'keystore.jks' | |
encodedString: ${{ secrets.KEYSTORE_BASE64 }} | |
- name: 'Expose keystore' | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
if: ${{ env.KEYSTORE_BASE64 }} | |
run: cp ${{ steps.unlock_keystore.outputs.filePath }} . | |
- name: 'Build' | |
run: ./gradlew build --no-daemon | |
env: | |
SIGN_KEYSTORE: ${{ secrets.SIGN_KEYSTORE }} | |
SIGN_ALIAS: ${{ secrets.SIGN_ALIAS }} | |
SIGN_KEYPASS: ${{ secrets.SIGN_KEYPASS }} | |
SIGN_STOREPASS: ${{ secrets.SIGN_STOREPASS }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_KEY: ${{ secrets.MAVEN_KEY }} | |
GITHUB_USER: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Test' | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
if: ${{ env.COVERALLS_REPO_TOKEN }} | |
run: ./gradlew test jacocoTestReport coveralls | |
- name: 'Game Test' | |
run: ./gradlew runGameTestServer | |
- name: 'Deploy as GitHub CI artifacts' | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
path: build/libs/* | |
- name: 'Deploy to CurseForge' | |
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') | |
env: | |
CURSEFORGE_KEY_SECRET: ${{ secrets.CURSEFORGE_KEY_SECRET }} | |
run: ./gradlew publishCurseForge | |
- name: 'Deploy to Modrinth' | |
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') | |
env: | |
MODRINTH_KEY_SECRET: ${{ secrets.MODRINTH_KEY_SECRET }} | |
run: ./gradlew modrinth | |
- name: 'Deploy to Maven' | |
if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/feature') | |
env: | |
MAVEN_URL: ${{ secrets.MAVEN_URL }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_KEY: ${{ secrets.MAVEN_KEY }} | |
run: ./gradlew publish | |
- name: 'Deploy JavaDoc to GitHub Pages' | |
if: startsWith(github.ref, 'refs/heads/master') | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: build/docs/javadoc | |
clean: true |