Initial commit: Welcome Screen mod v1.1.0
All checks were successful
Build VS Mod / build (push) Successful in 14s
All checks were successful
Build VS Mod / build (push) Successful in 14s
- Welcome screen GUI dialog on player join - Markdown to VTML converter - Mod checker (recommended/blacklisted mods) - HOME key to reopen - CI/CD pipeline for build + release
This commit is contained in:
77
.gitea/workflows/build.yml
Normal file
77
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,77 @@
|
||||
name: Build VS Mod
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
tags: ['v*']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and package mod
|
||||
run: |
|
||||
VERSION=$(grep -oPm1 '"version":\s*"\K[^"]+' resources/modinfo.json)
|
||||
MODID="welcomescreen"
|
||||
OUTPUT="${MODID}_${VERSION}.zip"
|
||||
|
||||
# Build inside .NET SDK container using docker cp (DinD — bind mounts don't work)
|
||||
docker volume create mod-build
|
||||
docker pull alpine:3 >/dev/null 2>&1
|
||||
HELPER=$(docker create -v mod-build:/src alpine:3 true)
|
||||
docker cp . $HELPER:/src/
|
||||
docker rm $HELPER >/dev/null
|
||||
|
||||
docker run --rm -v mod-build:/src -w /src mcr.microsoft.com/dotnet/sdk:8.0 \
|
||||
dotnet build -c Release
|
||||
|
||||
# Extract artifacts from volume
|
||||
HELPER=$(docker create -v mod-build:/src alpine:3 true)
|
||||
docker cp $HELPER:/src/bin/Release/WelcomeScreen.dll ./WelcomeScreen.dll
|
||||
docker rm $HELPER >/dev/null
|
||||
docker volume rm mod-build >/dev/null
|
||||
|
||||
# Package ZIP
|
||||
mkdir -p dist
|
||||
cp WelcomeScreen.dll dist/
|
||||
cp resources/modinfo.json dist/
|
||||
cd dist && zip -j "../${OUTPUT}" WelcomeScreen.dll modinfo.json
|
||||
cd ..
|
||||
|
||||
echo "MOD_ZIP=${OUTPUT}" >> $GITHUB_ENV
|
||||
echo "MOD_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
echo "Built ${OUTPUT}"
|
||||
|
||||
- name: Create release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
# Generate a temporary token for the API call
|
||||
TOKEN=$(docker exec gitea gitea admin user generate-access-token \
|
||||
--user git --username calic --scopes write 2>&1 | grep -oPm1 '(?<=: ).*')
|
||||
|
||||
# Create release with artifact
|
||||
RELEASE_ID=$(curl -sf \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Welcome Screen ${MOD_VERSION}\",\"body\":\"Release ${MOD_VERSION}\"}" \
|
||||
"http://gitea:3000/api/v1/repos/calic/vs-welcome-screen/releases" | grep -oPm1 '"id":\K[0-9]+')
|
||||
|
||||
# Upload artifact
|
||||
curl -sf \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-F "attachment=@${MOD_ZIP}" \
|
||||
"http://gitea:3000/api/v1/repos/calic/vs-welcome-screen/releases/${RELEASE_ID}/assets"
|
||||
|
||||
# Clean up token
|
||||
TOKEN_ID=$(curl -sf \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
"http://gitea:3000/api/v1/users/calic/tokens" | grep -oPm1 '"id":\K[0-9]+')
|
||||
curl -sf -X DELETE \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
"http://gitea:3000/api/v1/users/calic/tokens/${TOKEN_ID}"
|
||||
|
||||
echo "Release ${TAG} created with artifact ${MOD_ZIP}"
|
||||
Reference in New Issue
Block a user