doctor: a podman service older than it's packages cannot open a shell… #57
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] | |
| tags: ["v*"] | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Existing v* tag to (re)publish a release for; empty = CI build only" | |
| required: false | |
| default: "" | |
| permissions: | |
| contents: read | |
| # A new push to the same PR supersedes the previous run. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # fjordd is pure Go (CGO off), so a Linux runner cross-compiles the FreeBSD | |
| # binary directly -- no FreeBSD VM needed. The UI is built with vite, whose | |
| # output is platform-neutral and gets embedded into the binary (ui/dist). | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| GOOS: freebsd | |
| GOARCH: amd64 | |
| CGO_ENABLED: "0" | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| cache-dependency-path: ui/package-lock.json | |
| - name: Build UI | |
| working-directory: ui | |
| run: | | |
| npm ci | |
| npm run build | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Cross-compile fjordd (freebsd/amd64) | |
| run: | | |
| go build -trimpath -ldflags "-s -w" -o fjordd ./cmd/fjordd | |
| file fjordd | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fjordd-freebsd-amd64 | |
| path: | | |
| fjordd | |
| packaging/fjordd.rc | |
| if-no-files-found: error | |
| # On a v* tag: publish a GitHub Release with a self-contained source tarball | |
| # (vendored Go modules + prebuilt UI, so the FreeBSD port builds offline with | |
| # no npm) plus the ready-to-run binary. | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.tag != '' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| env: | |
| # The tag being released: the pushed tag, or the one named in a manual run | |
| # (which also checks that tag out, so assets match the tag, not main). | |
| TAG: ${{ github.event.inputs.tag || github.ref_name }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.inputs.tag || github.ref }} | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| cache-dependency-path: ui/package-lock.json | |
| - name: Build UI | |
| working-directory: ui | |
| run: | | |
| npm ci | |
| npm run build | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Assemble source tarball (vendored deps + prebuilt UI) | |
| run: | | |
| VERSION="${TAG#v}" | |
| go mod vendor | |
| STAGE="fjord-${VERSION}" | |
| rm -rf "$STAGE"; mkdir "$STAGE" | |
| git archive HEAD | tar -x -C "$STAGE" # tracked source | |
| cp -R vendor "$STAGE/" # offline Go modules | |
| mkdir -p "$STAGE/ui"; cp -R ui/dist "$STAGE/ui/" # prebuilt, embedded UI | |
| # Reproducible: same tag -> same bytes, so a re-run can never change | |
| # the checksum a port's distinfo already records. | |
| tar --sort=name --mtime="@$(git log -1 --format=%ct)" --owner=0 --group=0 --numeric-owner \ | |
| -cf - "$STAGE" | gzip -n > "fjord-${VERSION}.tar.gz" | |
| sha256sum "fjord-${VERSION}.tar.gz" | |
| # One binary per FreeBSD arch, named so `fetch .../fjordd-freebsd-$(uname -m)` | |
| # picks the right one. The rc script ships alongside. | |
| - name: Cross-compile binaries (freebsd/amd64, freebsd/arm64) | |
| env: | |
| GOOS: freebsd | |
| CGO_ENABLED: "0" | |
| run: | | |
| VERSION="${TAG#v}" | |
| for arch in amd64 arm64; do | |
| GOARCH=$arch go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" \ | |
| -o "fjordd-freebsd-${arch}" ./cmd/fjordd | |
| done | |
| cp packaging/fjordd.rc fjordd.rc | |
| ls -l fjordd-freebsd-* fjordd.rc | |
| # Create the release, or refresh the assets of an existing one (re-run on | |
| # the same tag after a workflow fix) -- never a second release. | |
| - name: Publish release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| ASSETS="fjord-${VERSION}.tar.gz fjordd-freebsd-amd64 fjordd-freebsd-arm64 fjordd.rc" | |
| if gh release view "${TAG}" --repo "${{ github.repository }}" >/dev/null 2>&1; then | |
| # A published tarball is immutable (ports pin its checksum): only | |
| # the binaries and rc script are refreshed on a re-run. | |
| if gh release view "${TAG}" --repo "${{ github.repository }}" --json assets --jq '.assets[].name' | grep -qx "fjord-${VERSION}.tar.gz"; then | |
| ASSETS="fjordd-freebsd-amd64 fjordd-freebsd-arm64 fjordd.rc" | |
| fi | |
| gh release upload "${TAG}" --repo "${{ github.repository }}" --clobber $ASSETS | |
| else | |
| gh release create "${TAG}" \ | |
| --repo "${{ github.repository }}" \ | |
| --title "fjord ${VERSION}" \ | |
| --generate-notes \ | |
| $ASSETS | |
| fi |