CI #104
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 compiler nightly so a fresh Unleashed Pascal is available. | |
| - cron: '0 1 * * *' | |
| 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:refs/tags/nightly || 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 >/dev/null 2>&1; then | |
| nightly_commit=$(git rev-list -n 1 nightly) | |
| 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 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 HEAD only | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Download windows-bundle.zip | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-bundle.zip | |
| - name: Download linux-bundle.zip | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-bundle.zip | |
| - name: Prepare release notes | |
| run: | | |
| ts=$(TZ=Europe/Berlin date +"%Y-%m-%d %H:%M:%S CEST") | |
| { | |
| echo "Unleashed Pascal IDE nightly build" | |
| echo | |
| echo "Generated from commit: $GITHUB_SHA" | |
| echo "Build time: $ts" | |
| } > release-body.txt | |
| - name: Publish nightly release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release delete nightly --yes --cleanup-tag --repo "$GITHUB_REPOSITORY" 2>/dev/null || true | |
| gh release create nightly \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --target "$GITHUB_SHA" \ | |
| --title "Unleashed Pascal IDE nightly" \ | |
| --notes-file release-body.txt \ | |
| --prerelease \ | |
| windows-bundle.zip \ | |
| linux-bundle.zip |