diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2038508..b88019f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,8 +5,9 @@ on: branches: - trunk schedule: - - cron: '0 22 1/2 * *' # every other day at midnight + - cron: '0 16 * * 5' # what could go wrong on a friday evening ¯\_ (ツ)_/¯ workflow_dispatch: + env: LUANTI_REPO: minetest/minetest LUANTI_DIR: luanti @@ -62,13 +63,18 @@ jobs: echo "Current version: ${CURRENT_VERSION}" echo "Latest version: ${LATEST_VERSION}" - if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then - echo "New release found: ${LATEST_VERSION}" - echo "SHOULD_BUILD=true" >> $GITHUB_OUTPUT - echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_OUTPUT - echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT + if [[ "$LATEST_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then + echo "Will make a build" + echo "SHOULD_BUILD=true" >> $GITHUB_OUTPUT + echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_OUTPUT + echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT + else + echo "No new release found." + echo "SHOULD_BUILD=false" >> $GITHUB_OUTPUT + fi else - echo "No new release found." + echo "Latest version is not a semantic version, skipping build." echo "SHOULD_BUILD=false" >> $GITHUB_OUTPUT fi @@ -91,6 +97,7 @@ jobs: uses: actions/checkout@v4 with: repository: ${{ env.LUANTI_REPO }} + ref: ${{ env.LATEST_VERSION }} path: ${{ env.LUANTI_DIR }} - name: Install system dependencies @@ -100,7 +107,6 @@ jobs: sudo apt-get install -y ${{ env.DEPENDENCIES }} - name: Download appimage-builder - if: steps.cache-tools-restore.outputs.cache-hit != 'true' run: | mkdir -p ${{ env.TOOLS_DIR }} cd ${{ env.TOOLS_DIR }} @@ -108,7 +114,6 @@ jobs: chmod +x appimage-builder.AppImage - name: Build Luanti - if: steps.cache-minetest-restore.outputs.cache-hit != 'true' run: | set -e cd ${{ env.LUANTI_DIR }}