This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Archiving Minefield (#253) #163
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 and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v2 | |
| with: | |
| go-version: '1.23' | |
| - name: Extract Git Tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo "GIT_TAG=${{ github.ref_name }}" >> $GITHUB_ENV | |
| - name: Docker Build | |
| run: | | |
| TAG="${GIT_TAG:-latest}" | |
| docker build \ | |
| -t ghcr.io/bitbomdev/minefield:latest \ | |
| -t ghcr.io/bitbomdev/minefield:"${TAG}" \ | |
| . | |
| - name: Log in to GHCR | |
| uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push Docker Images | |
| run: | | |
| TAG=${GIT_TAG:-latest} | |
| docker push ghcr.io/bitbomdev/minefield:latest | |
| docker push ghcr.io/bitbomdev/minefield:${TAG} |