chore: bump version #28
Workflow file for this run
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 default.*' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| fail-on-no-checks: false | |
| - run: nix build -o result | |
| - run: tar -chzvf smart-piano-engine.tar.gz -C result . | |
| - name: Cleanup Pre-Releases | |
| if: github.ref == 'refs/heads/main' | |
| run: | # Cleanup old rolling releases (> 7 days or < 12 hours) | |
| SEVEN_DAYS_AGO=$(date -d "7 days ago" +%s) | |
| TWELVE_HOURS_AGO=$(date -d "12 hours ago" +%s) | |
| gh release list --limit 100 --json tagName,createdAt --jq '.[] | "\(.tagName) \(.createdAt)"' | grep -E '^pre-[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}-[0-9]{2}-[0-9]{2} ' | while read -r OLD_TAG CREATED_AT; do | |
| TIMESTAMP=$(date -d "$CREATED_AT" +%s) | |
| if [ "$TIMESTAMP" -lt "$SEVEN_DAYS_AGO" ] || [ "$TIMESTAMP" -gt "$TWELVE_HOURS_AGO" ]; then | |
| gh release delete "$OLD_TAG" --yes --cleanup-tag | |
| fi | |
| done | |
| - name: Publish Timestamped Pre-Release | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| TAG="pre-$(date -u +%Y-%m-%dT%H-%M-%S)" | |
| gh release create "$TAG" smart-piano-engine.tar.gz --title "Pre-release $NOW" --notes "Automated pre-release for $NOW" --prerelease | |
| - name: Publish Semantically Versionned Release | |
| 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" |