Server/.forgejo/workflows/build.yml

102 lines
3.2 KiB
YAML
Raw Permalink Normal View History

2025-02-01 14:18:34 +01:00
name: Build Application
on:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?'
- "v*"
jobs:
build:
runs-on: stable
container:
image: git.euph.dev/actions/runner-java-21:latest
steps:
- name: "Checkout"
uses: "https://git.euph.dev/actions/checkout@v3"
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: "Prepare Gradle"
run: gradle clean
- name: "Build Jar"
run: gradle bootJar -Pversion=${{ github.ref_name }}
- name: Upload Jar as Artifact
uses: "https://git.euph.dev/actions/upload-artifact@v3"
with:
name: tower_defence_server.jar
path: build/libs/Tower-Defence-Server-${{ github.ref_name }}.jar
- name: Upload API Spec as Artifact
uses: "https://git.euph.dev/actions/upload-artifact@v3"
with:
name: api.yml
path: api/api.yml
2025-02-01 14:18:34 +01:00
- name: "Stop Gradle"
run: gradle --stop
build-docker:
runs-on: docker
needs:
- build
steps:
- name: "Checkout"
uses: "https://git.euph.dev/actions/checkout@v3"
- name: Download artifact from previous job
uses: "https://git.euph.dev/actions/download-artifact@v3"
with:
name: tower_defence_server.jar
path: .forgejo/workflows/
- name: Login to Registry
uses: "https://git.euph.dev/actions/docker-login@v3"
with:
registry: git.euph.dev
username: ${{ secrets.DEPLOY_USER }}
password: ${{ secrets.DEPLOY_SECRET }}
- name: Build and push Web Image
uses: "https://git.euph.dev/actions/docker-build-push@v5"
with:
context: ".forgejo/workflows/"
push: true
build-args: VERSION=${{ github.ref_name }}
tags: |
git.euph.dev/towerdefence/server:${{ github.ref_name }}
${{ contains(github.ref_name, 'rc') == false && 'git.euph.dev/towerdefence/server:latest' || '' }}
release:
runs-on: stable
container:
image: git.euph.dev/actions/runner-basic:latest
needs:
- build
- build-docker
steps:
- name: Download Server Jar
uses: "https://git.euph.dev/actions/download-artifact@v3"
with:
name: tower_defence_server.jar
path: release
- name: Download API Spec
uses: "https://git.euph.dev/actions/download-artifact@v3"
with:
name: api.yml
path: release
2025-02-01 14:18:34 +01:00
- name: Create Release
uses: "https://git.euph.dev/actions/release@v2"
with:
direction: upload
tag: ${{ github.ref_name }}
token: ${{ secrets.DEPLOY_TOKEN }}
prerelease: ${{ contains( github.ref_name, "rc") }}
release-dir: release
release-notes: |
# Tower Defence - Server ${{ github.ref_name }}
Read the [Documentation](https://git.euph.dev/TowerDefence/Dokumentation/wiki/Server/Config) to see how to setup the server.