From 1331bc1d4ab08f6335be5c083dfdbba40696d7ac Mon Sep 17 00:00:00 2001 From: ArthurErlich Date: Sat, 21 Mar 2026 14:15:42 +0100 Subject: [PATCH] chore(ci/cd): replaced worfklow with matrix, added dryrun button --- .gitea/workflows/release.yml | 109 +++++++++++------------------------ .vscode/settings.json | 5 ++ 2 files changed, 38 insertions(+), 76 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index f8bb3c6..2b4d749 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -5,6 +5,11 @@ on: branches: [release] pull_request: branches: [release] + workflow_dispatch: + inputs: + dummy: + description: "Dry Run — tests the build process without creating a release" + required: false env: GODOT_VERSION: 4.6.1 @@ -13,16 +18,32 @@ env: BLENDER_VERSION: 5.0.0 jobs: - export-windows: - name: Windows Export - runs-on: ubuntu-24.04 # Use 24.04 with godot 4 + export: + name: ${{ matrix.name }} Export + runs-on: ubuntu-24.04 container: barichello/godot-ci:4.6 + strategy: + matrix: + include: + - name: Windows + godot_preset: "Windows" + artifact_name: windows + output_ext: ".exe" + install_blender: true + - name: Linux + godot_preset: "Linux/X11" + artifact_name: linux + output_ext: ".x86_64" + install_blender: true + steps: - name: Update and install dependencies run: | apt-get update apt-get install -y curl gnupg - apt-get install -y blender + if [ "${{ matrix.install_blender }}" = "true" ]; then + apt-get install -y blender + fi - name: Install Node.js run: | @@ -48,96 +69,36 @@ jobs: exit 1 fi - # Set the Blender path if [ -n "${BLENDER_PATH:-}" ]; then if grep -q '^filesystem/import/blender/blender_path' "$GODOT_CFG"; then - # Replace existing path sed -i "s|^filesystem/import/blender/blender_path = .*|filesystem/import/blender/blender_path = \"$BLENDER_PATH\"|" "$GODOT_CFG" else - # Append new path echo "filesystem/import/blender/blender_path = \"$BLENDER_PATH\"" >> "$GODOT_CFG" fi fi echo "Blender path configured in $GODOT_CFG" - - name: Windows Build + - name: Build shell: bash run: | set -Eeuo pipefail - mkdir -v -p build/windows + mkdir -v -p build/${{ matrix.artifact_name }} EXPORT_DIR="$(readlink -f build)" cd $PROJECT_PATH - godot --headless --export-release "Windows" "$EXPORT_DIR/windows/$EXPORT_NAME.exe" - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: windows - path: build/windows - - export-linux: - name: Linux Export - runs-on: ubuntu-24.04 # Use 24.04 with godot 4 - container: barichello/godot-ci:4.6 - steps: - - name: Update and install dependencies - run: | - apt-get update - apt-get install -y curl gnupg - - - name: Install Node.js - run: | - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - - apt-get install -y nodejs - - - name: Checkout - uses: actions/checkout@v4 - with: - lfs: true - - name: Setup - shell: bash - run: | - set -Eeuo pipefail - BLENDER_PATH="/usr/bin/blender" - mkdir -pv ~/.config/godot - mkdir -pv ~/.local/share/godot/export_templates/ - GODOT_CFG="$(find ~/.config/godot -name "editor_settings-*.tres" | head -n 1 || true)" - - if [ -z "$GODOT_CFG" ]; then - echo "# Missing Godot editor settings" > "$GODOT_CFG" - exit 1 - fi - - # Set the Blender path - if [ -n "${BLENDER_PATH:-}" ]; then - if grep -q '^filesystem/import/blender/blender_path' "$GODOT_CFG"; then - # Replace existing path - sed -i "s|^filesystem/import/blender/blender_path = .*|filesystem/import/blender/blender_path = \"$BLENDER_PATH\"|" "$GODOT_CFG" - else - # Append new path - echo "filesystem/import/blender/blender_path = \"$BLENDER_PATH\"" >> "$GODOT_CFG" - fi - fi - echo "Blender path configured in $GODOT_CFG" - - - name: Linux Build - shell: bash - run: | - set -Eeuo pipefail - mkdir -v -p build/linux - EXPORT_DIR="$(readlink -f build)" - cd $PROJECT_PATH - godot --headless --export-release "Linux/X11" "$EXPORT_DIR/linux/$EXPORT_NAME.x86_64" + godot --headless --export-release "${{ matrix.godot_preset }}" \ + "$EXPORT_DIR/${{ matrix.artifact_name }}/$EXPORT_NAME${{ matrix.output_ext }}" - name: Upload Artifact uses: actions/upload-artifact@v3 with: - name: linux - path: build/linux + name: ${{ matrix.artifact_name }} + path: build/${{ matrix.artifact_name }} create-release: name: Create Release runs-on: ubuntu-latest - needs: [export-linux, export-windows] + needs: [export] + if: github.event_name == 'push' steps: - name: Checkout uses: actions/checkout@v4 @@ -157,7 +118,6 @@ jobs: - name: Extract version and body from CHANGELOG id: changelog run: | - # Extract the latest released version (skip Unreleased) LATEST=$(grep -E '^## \[[0-9]+\.[0-9]+\.[0-9]+\]' CHANGELOG.md | head -n1 | sed -E 's/^## \[([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/') if [ -z "$LATEST" ]; then @@ -168,17 +128,14 @@ jobs: echo "Released version found: $LATEST" echo "version=$LATEST" >> $GITHUB_OUTPUT - # Extract the body: lines until the next ## header BODY=$(awk -v ver="$LATEST" ' $0 ~ "^## \\[" ver "\\]" {found=1; next} found && $0 ~ "^## \\[" {exit} found {print} ' CHANGELOG.md) - # Trim leading/trailing empty lines BODY=$(echo "$BODY" | sed '/^\s*$/d') - # Output body safely for GitHub Actions echo "body<> $GITHUB_OUTPUT echo "$BODY" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4c367a5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "conventionalCommits.scopes": [ + "ci/cd" + ] +} \ No newline at end of file