Strip local metrics and remove geo resolver #100
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
| # Build D-LOCKSS binaries for multiple OS/arch. | |
| # Artifacts are available on the Actions run page; optionally attach to Releases. | |
| name: Build | |
| on: | |
| # Run on push to any branch (so pushing your branch triggers the build) | |
| push: | |
| pull_request: | |
| branches: [main, master] | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Show ref and cmd/ | |
| run: | | |
| echo "Branch / ref: ${{ github.ref }} (head: ${{ github.sha }})" | |
| ls -la | |
| ls -la cmd/ 2>/dev/null || echo "cmd/ missing or empty" | |
| ls -la cmd/dlockss/ 2>/dev/null || echo "cmd/dlockss/ missing" | |
| ls -la cmd/dlockss-monitor/ 2>/dev/null || echo "cmd/dlockss-monitor/ missing" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Verify cmd/ in repo | |
| run: | | |
| if [ ! -d "cmd/dlockss" ] || [ ! -d "cmd/dlockss-monitor" ]; then | |
| echo "::error::cmd/dlockss or cmd/dlockss-monitor missing. Fix .gitignore (use /dlockss not dlockss) then: git add cmd/ && git commit -m 'Track cmd/' && git push" | |
| ls -la cmd/ 2>/dev/null || true | |
| exit 1 | |
| fi | |
| - name: Build | |
| run: | | |
| set -e | |
| export CGO_ENABLED=0 | |
| mkdir -p dist | |
| for binary in dlockss dlockss-monitor; do | |
| case $binary in | |
| dlockss) PKG="./cmd/dlockss" ;; | |
| dlockss-monitor) PKG="./cmd/dlockss-monitor" ;; | |
| esac | |
| for goos in linux darwin windows; do | |
| for goarch in amd64 arm64; do | |
| [ "$goos" = "windows" ] && [ "$goarch" = "arm64" ] && continue | |
| suffix="" | |
| [ "$goos" = "windows" ] && suffix=".exe" | |
| out="dist/${binary}-${goos}-${goarch}${suffix}" | |
| echo "Building $out" | |
| GOOS=$goos GOARCH=$goarch go build -ldflags="-s -w" -o "$out" "$PKG" | |
| done | |
| done | |
| done | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries | |
| path: dist/ | |
| # Optional: upload binaries to GitHub Release when a release is published | |
| release: | |
| name: Upload to Release | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: build | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| release_id: ${{ github.event.release.id }} | |
| files: dist/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-docker-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3.7.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5.10.0 | |
| with: | |
| images: ghcr.io/gipplab/dlockss-single-node | |
| tags: | | |
| type=ref,event=pr | |
| type=ref,event=branch | |
| type=sha,prefix= | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| labels: | | |
| org.opencontainers.image.description=Dlockss single node | |
| org.opencontainers.image.title=Dlockss single node | |
| annotations: | | |
| org.opencontainers.image.description=Dlockss single node | |
| org.opencontainers.image.title=Dlockss single node | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3.12.0 | |
| - name: Build and push Docker jobrunner image | |
| uses: docker/build-push-action@v6.18.0 | |
| with: | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| cache-from: type=gha,scope=docker | |
| cache-to: type=gha,mode=max,scope=docker | |
| build-monitor-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3.7.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5.10.0 | |
| with: | |
| images: ghcr.io/gipplab/dlockss-monitor | |
| tags: | | |
| type=ref,event=pr | |
| type=ref,event=branch | |
| type=sha,prefix= | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| labels: | | |
| org.opencontainers.image.description=Dlockss monitor | |
| org.opencontainers.image.title=Dlockss monitor | |
| annotations: | | |
| org.opencontainers.image.description=Dlockss monitor | |
| org.opencontainers.image.title=Dlockss monitor | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3.12.0 | |
| - name: Build and push Docker jobrunner image | |
| uses: docker/build-push-action@v6.18.0 | |
| with: | |
| file: ./Dockerfile_monitor | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| no-cache: ${{ github.event.inputs.no_cache || false }} | |
| cache-from: type=gha,scope=docker-monitor | |
| cache-to: type=gha,mode=max,scope=docker-monitor | |