Maven #18
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: 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 18 (Corretto) | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '18' | |
distribution: 'corretto' | |
cache: maven | |
- name: Build with Maven | |
run: | | |
mvn -B package --file pom.xml | |
- name: Prepare artifacts | |
run: | | |
mkdir -p artifacts/player | |
mv player/target/teamgruen-player.jar artifacts/player/ | |
mv sdk/target/sdk-*.jar artifacts/ | |
mv player/assets/* artifacts/player/ | |
zip -r -j artifacts/teamgruen-player.zip artifacts/player | |
rm -rf artifacts/*/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: archives | |
path: artifacts/* | |
create-release: | |
needs: build | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: archives | |
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/* | |
deploy: | |
needs: build | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: archives | |
path: artifacts | |
file: teamgruen-player.zip | |
- 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.zip' | |
method: 'POST' | |
timeout: 5000 | |
customHeaders: | | |
{ | |
"Content-Type": "application/octet-stream", | |
"X-API-Key": "${{ secrets.UPLOAD_API_KEY }}" | |
} | |
file: artifacts/teamgruen-player.zip |