Skip to content

Maven

Maven #6

Workflow file for this run

name: Maven
on:
workflow_dispatch:
push:
paths:
- .github/.version
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set version
id: version
run: echo "version=$(cat .github/.version)" >> $GITHUB_OUTPUT
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: |
mvn -B package --file pom.xml
mkdir artifacts/
mv */target/*.jar artifacts/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jars
path: artifacts/*.jar
create-release:
needs: build
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: jars
path: artifacts
- name: Create Release
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: v${{ needs.build.outputs.version }}
title: v${{ needs.build.outputs.version }}
draft: false
prerelease: false
files: artifacts/*.jar
deploy:
needs: build
name: Deploy
runs-on: ubuntu-latest
environment: production
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: jars
path: artifacts
pattern: '*-player.jar'
- name: Upload client
uses: fjogeleit/http-request-action@v1
with:
url: 'https://sc-upload.justix.dev/api/v1/upload/v${{ needs.build.outputs.version }}?fileName=teamgruen-player.jar&params=--debug%20--batch-mode'
method: 'POST'
timeout: 15000
customHeaders: |
{
"Content-Type": "application/octet-stream",
"X-API-Key": "${{ secrets.UPLOAD_API_KEY }}"
}
file: artifacts/teamgruen-player.jar