Repository navigation
refactor: centralize sync polling in cron #283
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: build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: build:required | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/prepare | |
| - run: bun run build:linux | |
| - run: bun run test:binary | |
| - name: Prepare nibrun download | |
| run: | | |
| mkdir -p release | |
| cp apps/web/dist/app release/open-sync | |
| cd release | |
| sha256sum open-sync > open-sync.sha256 | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: nibrun-binary | |
| path: release/ | |
| if-no-files-found: error | |
| browser: | |
| name: browser:required | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/prepare | |
| - run: bunx playwright install --with-deps chromium | |
| - run: bun run test:browser | |
| - uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: browser-evidence | |
| path: artifacts/ | |
| if-no-files-found: ignore | |
| publish-nibrun: | |
| name: publish:nibrun | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| needs: [build, browser] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: nibrun-release | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: nibrun-binary | |
| - name: Publish rolling nibrun release | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| if [[ "$(gh api "repos/$GH_REPO/git/ref/heads/main" --jq .object.sha)" != "$GITHUB_SHA" ]]; then | |
| echo "A newer main commit exists; leaving the published binary unchanged." | |
| exit 0 | |
| fi | |
| sha256sum --check open-sync.sha256 | |
| notes="Built from ${GITHUB_SHA}. The Linux x86_64 binary includes the dashboard and migrations. These assets are replaced after the binary and browser checks pass on main." | |
| if gh release view nibrun-latest >/dev/null 2>&1; then | |
| gh release upload nibrun-latest open-sync open-sync.sha256 --clobber | |
| gh api "repos/$GH_REPO/git/refs/tags/nibrun-latest" \ | |
| --method PATCH -f sha="$GITHUB_SHA" -F force=true | |
| gh release edit nibrun-latest --prerelease --latest=false --notes "$notes" | |
| else | |
| gh release create nibrun-latest open-sync open-sync.sha256 \ | |
| --target "$GITHUB_SHA" --title "nibrun deployment" \ | |
| --prerelease --latest=false --notes "$notes" | |
| fi |