ci: add individual github workflows for building dockerfiles #1
Workflow file for this run
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 docker image: gcloud' | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '*.*.*' | |
| - 'v*.*.*' | |
| - '*.*.*-*' | |
| - 'v*.*.*-*' | |
| paths: | |
| - 'dockers/gcloud.Dockerfile' | |
| - 'Makefile' | |
| pull_request: | |
| paths: | |
| - 'dockers/gcloud.Dockerfile' | |
| - 'Makefile' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 10 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USER }} | |
| password: ${{ secrets.DOCKERHUB_PASS }} | |
| - name: Build the Docker image (PR) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| export DOCKER_USER="${{ secrets.DOCKERHUB_USER }}" | |
| [ -z "$DOCKER_USER" ] && DOCKER_USER="kpango" | |
| make build_gcloud DOCKER_PUSH=false USER=$DOCKER_USER GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push the Docker image (Master/Tags) | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| export DOCKER_USER="${{ secrets.DOCKERHUB_USER }}" | |
| [ -z "$DOCKER_USER" ] && DOCKER_USER="kpango" | |
| VERSION="latest" | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| make build_gcloud DOCKER_PUSH=true USER=$DOCKER_USER VERSION=$VERSION GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} |