Skip to content

Commit

Permalink
ci(build): fix inconsistent builds
Browse files Browse the repository at this point in the history
we were building from the current state of master whenever the job ran,
which is incorrect. it should've checked the exact tag out before building. this commit fixes that

it also adds a simple regex to filter out other releases(e.g.: for android)
  • Loading branch information
zyachel committed Nov 8, 2024
1 parent c7c387f commit 76f5d90
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -100,15 +107,13 @@ 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 }}
wget -O appimage-builder.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
chmod +x appimage-builder.AppImage
- name: Build Luanti
if: steps.cache-minetest-restore.outputs.cache-hit != 'true'
run: |
set -e
cd ${{ env.LUANTI_DIR }}
Expand Down

0 comments on commit 76f5d90

Please sign in to comment.