fix(sync): tolerate 404 when deleting superseded OBS files #2
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 obs-tools Docker image | |
| # Rebuilds and publishes ghcr.io/<owner>/obs-tools:latest whenever the | |
| # Dockerfile, Python dependencies, or the pinned Go toolchain version change. | |
| # All workflow jobs that call .github/actions/obs-setup run inside this | |
| # container so they don't have to reinstall OBS service binaries, Go, gh CLI, | |
| # or the Python venv on every run. | |
| # | |
| # root/macros.yaml is a trigger because its GOLANG_VERSION macro pins the Go | |
| # toolchain baked into the image (see the Dockerfile) — the same macro that | |
| # versions the golang-1.26 OBS package, so a Go bump updates both in one | |
| # commit and the toolchain that vendors go modules in CI can never drift | |
| # from the one OBS builds against. | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/docker/obs-tools/Dockerfile' | |
| - 'requirements.txt' | |
| - 'root/macros.yaml' | |
| workflow_dispatch: {} | |
| jobs: | |
| build: | |
| name: Build and push obs-tools image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/setup-buildx-action@v3 | |
| # Extract the pinned Go version from the same macro that versions the | |
| # golang-1.26 OBS package. Format in root/macros.yaml: | |
| # - GOLANG_VERSION: 1.26.5 | |
| - name: Read pinned Go version | |
| id: gover | |
| run: | | |
| GO_VERSION=$(sed -n 's/^- *GOLANG_VERSION: *//p' root/macros.yaml | head -1 | tr -d '"'"' ") | |
| if [ -z "$GO_VERSION" ]; then | |
| echo "GOLANG_VERSION not found in root/macros.yaml" >&2 | |
| exit 1 | |
| fi | |
| echo "version=${GO_VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Pinned Go toolchain: ${GO_VERSION}" | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: .github/docker/obs-tools/Dockerfile | |
| push: true | |
| build-args: | | |
| GO_VERSION=${{ steps.gover.outputs.version }} | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/obs-tools:latest | |
| ghcr.io/${{ github.repository_owner }}/obs-tools:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |