doc: Update README.md to reflect Go version change and enhance Docker… #9
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: CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| go-ci: | |
| name: Go checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| cache: true | |
| - name: Verify formatting | |
| run: | | |
| test -z "$(gofmt -l .)" | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Test | |
| run: go test ./... | |
| - name: Build (CLI) | |
| run: go build -o tmdb ./cmd/tmdb | |
| docker: | |
| name: Docker build & push (GHCR) | |
| runs-on: ubuntu-latest | |
| needs: [go-ci] | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| # latest only on main branch | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| # semantic version from git tag (v0.1.0 → 0.1.0) | |
| type=semver,pattern={{version}} | |
| # short commit sha | |
| type=sha,format=short | |
| - name: Build and push image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |