CI #125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| force_build: | |
| description: 'Build even when HEAD already matches the nightly tag' | |
| type: boolean | |
| default: false | |
| schedule: | |
| # Run after the Lazarus Unleashed nightly so both FPC and Lazarus | |
| # bundles are fresh (FPC: 00:00 UTC, Lazarus: 01:00 UTC). | |
| # Only the default branch honours this; pixie is dispatched from there. | |
| - cron: '0 2 * * *' | |
| env: | |
| # pixie ships its own release so it never touches the one main publishes | |
| NIGHTLY_TAG: nightly-pixie | |
| jobs: | |
| check-for-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_build: ${{ steps.check.outputs.should_build }} | |
| steps: | |
| - name: Checkout HEAD only | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Fetch nightly tag only | |
| run: git fetch origin "refs/tags/$NIGHTLY_TAG:refs/tags/$NIGHTLY_TAG" || true | |
| - name: Check for changes since nightly | |
| id: check | |
| run: | | |
| if [ "${{ inputs.force_build }}" = "true" ]; then | |
| echo "force_build requested, skipping commit comparison" | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| if git rev-parse "$NIGHTLY_TAG" >/dev/null 2>&1; then | |
| nightly_commit=$(git rev-list -n 1 "$NIGHTLY_TAG") | |
| head_commit=$(git rev-parse HEAD) | |
| echo "Nightly tag commit: $nightly_commit" | |
| echo "HEAD commit: $head_commit" | |
| if [ "$nightly_commit" = "$head_commit" ]; then | |
| echo "No new commits since nightly release" | |
| echo "should_build=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "New commits found since nightly release" | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "No '$NIGHTLY_TAG' tag found - will build" | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| fi | |
| windows: | |
| needs: check-for-changes | |
| if: needs.check-for-changes.outputs.should_build == 'true' | |
| uses: ./.github/workflows/windows.yml | |
| linux: | |
| needs: check-for-changes | |
| if: needs.check-for-changes.outputs.should_build == 'true' | |
| uses: ./.github/workflows/linux.yml | |
| release: | |
| needs: [windows, linux] | |
| if: needs.windows.result == 'success' && needs.linux.result == 'success' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout installer source | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Download installer_win64_x86_64.exe | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: installer_win64_x86_64.exe | |
| - name: Download installer_linux_x86_64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: installer_linux_x86_64 | |
| - name: Download installer_linux_x86_64.AppImage | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: installer_linux_x86_64.AppImage | |
| - name: Prepare release notes | |
| run: | | |
| ts=$(TZ=Europe/Berlin date +"%Y-%m-%d %H:%M:%S CEST") | |
| # maj/min/rev come from the committed .lpi; BuildNr is the GH run number | |
| # (same value the builds bumped into their copies before compiling). | |
| maj=$(grep -oP '<MajorVersionNr Value="\K[0-9]+' src/installer.lpi || echo 0) | |
| min=$(grep -oP '<MinorVersionNr Value="\K[0-9]+' src/installer.lpi || echo 0) | |
| rev=$(grep -oP '<RevisionNr Value="\K[0-9]+' src/installer.lpi || echo 0) | |
| ver="${maj}.${min}.${rev}.${GITHUB_RUN_NUMBER}" | |
| { | |
| echo "Unleashed Installer PixieUI nightly build" | |
| echo | |
| echo "Generated from commit: $GITHUB_SHA" | |
| echo "Build time: $ts" | |
| echo "Version: $ver" | |
| } > release-body.txt | |
| - name: Publish nightly release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release delete "$NIGHTLY_TAG" --yes --cleanup-tag --repo "$GITHUB_REPOSITORY" 2>/dev/null || true | |
| gh release create "$NIGHTLY_TAG" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --target "$GITHUB_SHA" \ | |
| --title "Unleashed Installer PixieUI nightly" \ | |
| --notes-file release-body.txt \ | |
| --prerelease \ | |
| installer_win64_x86_64.exe \ | |
| installer_linux_x86_64 \ | |
| installer_linux_x86_64.AppImage |