Release from the version in project.godot
The version now lives in project.godot (application/config/version) and Settings.version reads it from there. The Build workflow tests and exports on every push, and on main creates the tag, uploads the builds and creates the Gitea release when that version has no tag yet. This replaces gitea-release.yaml, which released when a branch named after the version was pushed. Godot setup moves into a local .gitea/actions/setup-godot action shared by the test and build jobs, and Godot is updated to 4.7.2 to match the editor the project is made with.
This commit is contained in:
1 parent
f67dccbf52
commit
c1fc24adf9
8 files changed
+150
-135
No files matched your search
@@ -0,0 +1,38 @@
|
||||
name: "Setup Godot"
|
||||
description: "Downloads Godot for Linux, puts it on PATH as `godot` and optionally installs the export templates"
|
||||
|
||||
inputs:
|
||||
version:
|
||||
description: "Godot version, e.g. 4.7.2"
|
||||
required: true
|
||||
export-templates:
|
||||
description: "Also install the export templates ('true' or 'false')"
|
||||
required: false
|
||||
default: "false"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download Godot
|
||||
shell: bash
|
||||
run: |
|
||||
URL="https://github.com/godotengine/godot-builds/releases/download/${{ inputs.version }}-stable"
|
||||
mkdir -p "$HOME/.godot-bin"
|
||||
curl --fail -L -o godot.zip "$URL/Godot_v${{ inputs.version }}-stable_linux.x86_64.zip"
|
||||
unzip -q godot.zip
|
||||
mv "Godot_v${{ inputs.version }}-stable_linux.x86_64" "$HOME/.godot-bin/godot"
|
||||
chmod +x "$HOME/.godot-bin/godot"
|
||||
rm godot.zip
|
||||
echo "$HOME/.godot-bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Install Export Templates
|
||||
if: inputs.export-templates == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
URL="https://github.com/godotengine/godot-builds/releases/download/${{ inputs.version }}-stable"
|
||||
TEMPLATES_DIR="$HOME/.local/share/godot/export_templates/${{ inputs.version }}.stable"
|
||||
curl --fail -L -o export_templates.tpz "$URL/Godot_v${{ inputs.version }}-stable_export_templates.tpz"
|
||||
unzip -q export_templates.tpz
|
||||
mkdir -p "$TEMPLATES_DIR"
|
||||
mv templates/* "$TEMPLATES_DIR"
|
||||
rm -r templates export_templates.tpz
|
||||
@@ -1,6 +1,17 @@
|
||||
#
|
||||
# .gitea/workflows/gitea-build.yaml
|
||||
#
|
||||
# Tests and exports MusicPlayer on every push and pull request to main and develop,
|
||||
# and releases it from main.
|
||||
#
|
||||
# Releases follow the version in project.godot (application/config/version). Bump it,
|
||||
# push to main, and once the tests and exports pass the builds are uploaded to the
|
||||
# package registry and the tag and Gitea release are created. If that version already
|
||||
# has a tag, nothing is released. See RELEASING.md.
|
||||
#
|
||||
# All jobs run in this one workflow, one after another: separate workflows started by
|
||||
# the same push run at the same time on the single runner and can break each other's
|
||||
# copy of a shared action.
|
||||
#
|
||||
|
||||
name: "Build"
|
||||
@@ -11,25 +22,23 @@ on:
|
||||
branches: [main, develop]
|
||||
|
||||
env:
|
||||
GODOT_VERSION: 4.7
|
||||
PROJECT_PATH: .
|
||||
EXPORT_NAME: MusicPlayer
|
||||
GODOT_VERSION: 4.7.2
|
||||
PROJECT_NAME: MusicPlayer
|
||||
|
||||
jobs:
|
||||
# Runs before build in the same workflow, so the two never race for the runner
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Download Godot
|
||||
run: |
|
||||
curl -L -o godot.zip https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_linux.x86_64.zip
|
||||
unzip godot.zip
|
||||
mv Godot_v$GODOT_VERSION-stable_linux.x86_64 godot
|
||||
chmod +x godot
|
||||
- name: Run tests
|
||||
run: GODOT=./godot ./run_tests.sh
|
||||
|
||||
- name: Setup Godot
|
||||
uses: ./.gitea/actions/setup-godot
|
||||
with:
|
||||
version: ${{ env.GODOT_VERSION }}
|
||||
|
||||
- name: Run Tests
|
||||
run: ./run_tests.sh
|
||||
|
||||
build:
|
||||
needs: test
|
||||
@@ -38,41 +47,62 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Download Godot
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Read Version
|
||||
id: version
|
||||
run: |
|
||||
#echo "https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_linux.x86_64.zip"
|
||||
curl -L -o godot.zip https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_linux.x86_64.zip
|
||||
unzip godot.zip
|
||||
mv Godot_v$GODOT_VERSION-stable_linux.x86_64 godot
|
||||
chmod +x godot
|
||||
GAME_VERSION="$(sed -n 's/^config\/version="\(.*\)"$/\1/p' project.godot)"
|
||||
if [ -z "$GAME_VERSION" ]; then
|
||||
echo "No application/config/version in project.godot"
|
||||
exit 1
|
||||
fi
|
||||
echo "GAME_VERSION=$GAME_VERSION" >> "$GITHUB_ENV"
|
||||
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
|
||||
echo "Not on main, building without releasing"
|
||||
echo "release=false" >> "$GITHUB_OUTPUT"
|
||||
elif git rev-parse -q --verify "refs/tags/$GAME_VERSION" > /dev/null; then
|
||||
echo "$GAME_VERSION is already released, building without releasing"
|
||||
echo "release=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Releasing $GAME_VERSION"
|
||||
echo "release=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Download Godot Export Templates
|
||||
- name: Setup Godot
|
||||
uses: ./.gitea/actions/setup-godot
|
||||
with:
|
||||
version: ${{ env.GODOT_VERSION }}
|
||||
export-templates: "true"
|
||||
|
||||
- name: Export
|
||||
run: |
|
||||
#echo "https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_export_templates.tpz"
|
||||
curl -L -o export_templates.zip https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_export_templates.tpz
|
||||
unzip export_templates.zip
|
||||
mkdir -p build
|
||||
godot --headless --path . --import
|
||||
godot --headless --path . --export-release "Windows Desktop" "build/${PROJECT_NAME}_${GAME_VERSION}.exe"
|
||||
godot --headless --path . --export-release "Linux" "build/${PROJECT_NAME}_${GAME_VERSION}.x86_64"
|
||||
ls -la build
|
||||
|
||||
- name: Install Export Templates
|
||||
- name: Upload Artifacts
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: |
|
||||
mkdir -p ~/.local/share/godot/export_templates/$GODOT_VERSION.stable
|
||||
mv ./templates/* ~/.local/share/godot/export_templates/$GODOT_VERSION.stable
|
||||
|
||||
- name: Create build folder
|
||||
run: |
|
||||
mkdir -v -p build
|
||||
|
||||
- name: Windows Build
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
./godot --headless --verbose --export-release "Windows Desktop" "build/$EXPORT_NAME.exe"
|
||||
|
||||
- name: Linux Build
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
./godot --headless --verbose --export-release "Linux" "build/$EXPORT_NAME.x86_64"
|
||||
|
||||
# - name: MacOS Build
|
||||
# run: |
|
||||
# cd $PROJECT_PATH
|
||||
# ./godot --headless --verbose --export-release "macOS" "build/$EXPORT_NAME.zip"
|
||||
for FILE in build/${PROJECT_NAME}_${GAME_VERSION}*; do
|
||||
NAME="$(basename "$FILE")"
|
||||
echo "Uploading $NAME"
|
||||
curl --fail --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
|
||||
--upload-file "$FILE" \
|
||||
https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$NAME
|
||||
done
|
||||
|
||||
- name: Create Release
|
||||
if: steps.version.outputs.release == 'true'
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
env:
|
||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
||||
with:
|
||||
tag_name: ${{ env.GAME_VERSION }}
|
||||
target_commitish: ${{ github.sha }}
|
||||
files: |-
|
||||
build/${{ env.PROJECT_NAME }}_*
|
||||
@@ -1,90 +0,0 @@
|
||||
#
|
||||
# .gitea/workflows/gitea-release.yaml
|
||||
#
|
||||
#
|
||||
|
||||
name: "Publish"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*.*'
|
||||
|
||||
env:
|
||||
GODOT_VERSION: 4.7
|
||||
PROJECT_PATH: .
|
||||
PROJECT_NAME: MusicPlayer
|
||||
GAME_VERSION: ${{gitea.ref_name}}
|
||||
EXPORT_NAME: MusicPlayer_${{gitea.ref_name}}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Download Godot
|
||||
run: |
|
||||
#echo "https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_linux.x86_64.zip"
|
||||
curl -L -o godot.zip https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_linux.x86_64.zip
|
||||
unzip godot.zip
|
||||
mv Godot_v$GODOT_VERSION-stable_linux.x86_64 godot
|
||||
chmod +x godot
|
||||
|
||||
- name: Download Godot Export Templates
|
||||
run: |
|
||||
#echo "https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_export_templates.tpz"
|
||||
curl -L -o export_templates.zip https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION-stable/Godot_v$GODOT_VERSION-stable_export_templates.tpz
|
||||
unzip export_templates.zip
|
||||
|
||||
- name: Install Export Templates
|
||||
run: |
|
||||
mkdir -p ~/.local/share/godot/export_templates/$GODOT_VERSION.stable
|
||||
mv ./templates/* ~/.local/share/godot/export_templates/$GODOT_VERSION.stable
|
||||
|
||||
- name: Create build folder
|
||||
run: |
|
||||
mkdir -v -p build
|
||||
|
||||
- name: Windows Build
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
./godot --headless --verbose --export-release "Windows Desktop" "build/$EXPORT_NAME.exe"
|
||||
|
||||
- name: Linux Build
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
./godot --headless --verbose --export-release "Linux" "build/$EXPORT_NAME.x86_64"
|
||||
|
||||
# - name: MacOS Build
|
||||
# run: |
|
||||
# cd $PROJECT_PATH
|
||||
# ./godot --headless --verbose --export-release "macOS" "build/$EXPORT_NAME.zip"
|
||||
|
||||
- name: Upload Artifact Windows
|
||||
run: |
|
||||
#ls -la build
|
||||
curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
|
||||
--upload-file "build/$EXPORT_NAME.exe" \
|
||||
https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.exe
|
||||
|
||||
- name: Upload Artifact Linux
|
||||
run: |
|
||||
ls -la build
|
||||
curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
|
||||
--upload-file "build/$EXPORT_NAME.x86_64" \
|
||||
https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.x86_64
|
||||
|
||||
# - name: Upload Artifact MacOS
|
||||
# run: |
|
||||
# ls -la build
|
||||
# curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
|
||||
# --upload-file "build/$EXPORT_NAME.zip" \
|
||||
# https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.zip
|
||||
|
||||
- name: Create release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
env:
|
||||
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
||||
with:
|
||||
files: |-
|
||||
build/**
|
||||
Reference in new issue
Block a user