The icon is a plate wearing headphones with a red Nordic house cookie on it. It replaces the default Godot icon, so the game window, Windows and macOS builds use it. Linux programs can't carry their own icon, so the build now also makes MusicPlayer_<version>_linux.tar.gz with the game, the icon as a PNG, a .desktop menu entry and install.sh, which installs them for the current user. The bare Linux binary is still published.
114 lines
3.7 KiB
YAML
114 lines
3.7 KiB
YAML
#
|
|
# .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"
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main, develop]
|
|
|
|
env:
|
|
GODOT_VERSION: 4.7.2
|
|
PROJECT_NAME: MusicPlayer
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Godot
|
|
uses: ./.gitea/actions/setup-godot
|
|
with:
|
|
version: ${{ env.GODOT_VERSION }}
|
|
|
|
- name: Run Tests
|
|
run: ./run_tests.sh
|
|
|
|
build:
|
|
needs: test
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: Read Version
|
|
id: version
|
|
run: |
|
|
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: Setup Godot
|
|
uses: ./.gitea/actions/setup-godot
|
|
with:
|
|
version: ${{ env.GODOT_VERSION }}
|
|
export-templates: "true"
|
|
|
|
- name: Export
|
|
run: |
|
|
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"
|
|
|
|
# Linux binaries can't hold an icon; the package adds it with a menu entry and installer
|
|
- name: Package Linux
|
|
run: |
|
|
linux/package.sh "build/${PROJECT_NAME}_${GAME_VERSION}.x86_64" "$GAME_VERSION" build
|
|
ls -la build
|
|
|
|
- name: Upload Artifacts
|
|
if: steps.version.outputs.release == 'true'
|
|
run: |
|
|
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 }}_*
|