82 lines
2.7 KiB
YAML
82 lines
2.7 KiB
YAML
name: Build AsminVoicechat
|
|
run-name: Build AsminVoicechat
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: asmin-voicechat-release
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: docker-builder
|
|
steps:
|
|
- name: Checkout repository and tags
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Java 25
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '25'
|
|
|
|
- name: Calculate next version
|
|
id: version
|
|
shell: bash
|
|
run: |
|
|
latest="$(git tag --list 'v[0-9]*' --sort=-version:refname | head -n 1)"
|
|
if [[ -z "$latest" ]]; then
|
|
version="1.0.1"
|
|
else
|
|
current="${latest#v}"
|
|
IFS='.' read -r major minor patch <<< "$current"
|
|
if (( patch >= 9 )); then
|
|
version="$major.$((minor + 1)).0"
|
|
else
|
|
version="$major.$minor.$((patch + 1))"
|
|
fi
|
|
fi
|
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
echo "tag=v$version" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build plugin and run crypto test
|
|
shell: bash
|
|
env:
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
chmod +x ./gradlew
|
|
./gradlew --no-daemon clean build -PbuildVersion="$VERSION"
|
|
|
|
- name: Create Gitea release and upload plugin
|
|
shell: bash
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
TAG: ${{ steps.version.outputs.tag }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ -z "$GITEA_TOKEN" ]]; then
|
|
echo "Add a repository write token as the GITEA_TOKEN secret."
|
|
exit 1
|
|
fi
|
|
jar="build/libs/AsminVoiceChat-${VERSION}.jar"
|
|
api="$GITEA_SERVER_URL/api/v1/repos/$GITEA_REPOSITORY"
|
|
release="$(curl --fail-with-body -sS -X POST "$api/releases" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H 'Content-Type: application/json' \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"AsminVoiceChat $VERSION\",\"body\":\"AsminVoiceChat $VERSION\",\"draft\":false,\"prerelease\":false}")"
|
|
release_id="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])' <<< "$release")"
|
|
curl --fail-with-body -sS -X POST "$api/releases/$release_id/assets?name=AsminVoiceChat-${VERSION}.jar" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "attachment=@$jar;filename=AsminVoiceChat-${VERSION}.jar"
|