This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Nightly Builds #30
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: Nightly Builds | |
| on: | |
| schedule: | |
| - cron: "0 4 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| check: | |
| name: Check for new commits | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_build: ${{ steps.check.outputs.should_build }} | |
| sha: ${{ steps.check.outputs.sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for commits in last 24 hours | |
| id: check | |
| run: | | |
| SHA=$(git rev-parse HEAD) | |
| echo "sha=$SHA" >> "$GITHUB_OUTPUT" | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "should_build=true" >> "$GITHUB_OUTPUT" | |
| echo "Manual trigger — building regardless of commit age" | |
| exit 0 | |
| fi | |
| RECENT=$(git log --since="24 hours ago" --oneline) | |
| if [ -n "$RECENT" ]; then | |
| echo "should_build=true" >> "$GITHUB_OUTPUT" | |
| echo "New commits found:" | |
| echo "$RECENT" | |
| else | |
| echo "should_build=false" >> "$GITHUB_OUTPUT" | |
| echo "No new commits in the last 24 hours — skipping build" | |
| fi | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: check | |
| if: needs.check.outputs.should_build == 'true' | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| - target: x86_64-apple-darwin | |
| runner: macos-latest | |
| - target: aarch64-apple-darwin | |
| runner: macos-latest | |
| - target: x86_64-pc-windows-msvc | |
| runner: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Checkout sibling dep — presentar (presentar-terminal, presentar-core, presentar-test) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: paiml/presentar | |
| path: deps/presentar | |
| - name: Symlink sibling deps to expected paths (unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| ln -sf "$GITHUB_WORKSPACE/deps/presentar" "$GITHUB_WORKSPACE/../presentar" | |
| - name: Symlink sibling deps to expected paths (windows) | |
| if: runner.os == 'Windows' | |
| shell: cmd | |
| run: | | |
| mklink /D "%GITHUB_WORKSPACE%\..\presentar" "%GITHUB_WORKSPACE%\deps\presentar" | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Ensure target is installed | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package (unix) | |
| if: matrix.target != 'x86_64-pc-windows-msvc' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../simular-${{ matrix.target }}.tar.gz simular | |
| cd ../../.. | |
| - name: Package (windows) | |
| if: matrix.target == 'x86_64-pc-windows-msvc' | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| 7z a ../../../simular-${{ matrix.target }}.zip simular.exe | |
| cd ../../.. | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: simular-${{ matrix.target }} | |
| path: simular-${{ matrix.target }}.* | |
| release: | |
| name: Release | |
| needs: [check, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Delete existing nightly release | |
| run: gh release delete nightly --yes --cleanup-tag 2>/dev/null || true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: nightly | |
| name: Nightly Build | |
| prerelease: true | |
| make_latest: false | |
| body: | | |
| Automated nightly build from `main`. | |
| **Commit:** ${{ needs.check.outputs.sha }} | |
| > This is a pre-release build and may be unstable. | |
| files: artifacts/* |