Skip to content

Merge pull request #59 from jgeramb/release-please--branches--main #92

Merge pull request #59 from jgeramb/release-please--branches--main

Merge pull request #59 from jgeramb/release-please--branches--main #92

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
testing: ${{ steps.testing.outputs.testing }}
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
if: ${{ !env.ACT }}
uses: google-github-actions/release-please-action@v4
with:
token: "${{ secrets.GITHUB_TOKEN }}"
release-type: "maven"
- id: testing
if: ${{ env.ACT }}
run: echo "testing=true" >> $GITHUB_OUTPUT
build:
needs: create-release
name: Build
if: ( needs.create-release.outputs.testing || needs.create-release.outputs.release_created )
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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: Add artifacts to release
if: ${{ needs.create-release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.create-release.outputs.tag_name }} artifacts/*
- name: Upload artifact
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: archives
path: artifacts/*
deploy:
needs: [create-release, build]
name: Deploy
if: ${{ needs.create-release.outputs.release_created }}
runs-on: ubuntu-latest
environment: production
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: archives
path: artifacts
- name: Upload client
uses: fjogeleit/http-request-action@v1
with:
url: 'https://sc-upload.justix.dev/api/v1/upload/${{ needs.create-release.outputs.tag_name }}?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