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
40ed4da908
commit
249462f4a1
8 files changed
+150
-135
No files matched your search
@@ -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 }}_*
|
||||
Reference in new issue
Block a user