doc: clean toc #18
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
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| issues: write | |
| checks: read | |
| statuses: read | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| extra_nix_config: | | |
| extra-substituters = https://cache.garnix.io | |
| extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= | |
| - uses: DeterminateSystems/magic-nix-cache-action@v13 | |
| - run: sleep 15 # Sleep hoping Garnix evaluation will start after | |
| - uses: lewagon/wait-on-check-action@v1.5.0 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| check-regexp: 'Evaluate flake.nix' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: lewagon/wait-on-check-action@v1.5.0 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| check-regexp: 'package smart-piano.*' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| fail-on-no-checks: false | |
| - run: nix build .#smart-piano -o result | |
| - run: tar -chzvf smart-piano-engine.tar.gz -C result . | |
| - if: github.ref == 'refs/heads/main' | |
| run: | | |
| DATE=$(date -u +%Y-%m-%dT%H:%M:%S) | |
| TAG="pre-$DATE" | |
| # Cleanup old rolling releases (> 7 days or < 12 hours) | |
| gh release list --limit 100 | grep "pre-" | while read -r line; do | |
| OLD_TAG=$(echo "$line" | awk '{print $1}') | |
| OLD_DATE=${OLD_TAG#pre-} | |
| # Simple date comparison | |
| TIMESTAMP=$(date -d "$OLD_DATE" +%s) | |
| if [ "$TIMESTAMP" -lt "$(date -d "7 days ago" +%s)" ] || [ "$TIMESTAMP" -gt "$(date -d "12 hours ago" +%s)" ]; then | |
| gh release delete "$OLD_TAG" --yes --cleanup-tag | |
| fi | |
| done | |
| gh release create "$TAG" smart-piano-engine.tar.gz --title "$DATE" --notes "Automated pre-release for $DATE" --prerelease | |
| - if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| gh release create "$TAG" smart-piano-engine.tar.gz --title "SmartPiano $TAG" --notes "Release $TAG" |