BUG UPDATE: add authentication #2
Workflow file for this run
This file contains 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 | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the main branch | |
on: | |
pull_request: | |
branches: | |
- main | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
# - linux/arm/v7 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 # Checkout the repository code | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 # (Optional) Setup QEMU if needed | |
with: | |
platforms: ${{ matrix.platform }} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 # (Optional) Setup Docker Buildx if needed | |
with: | |
driver-opts: network=host | |
- | |
name: Login to Dockerhub # https://docs.docker.com/build/ci/github-actions/push-multi-registries/ | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.ZXZ_DOCKERHUB_PAT }} | |
- | |
name: Declare some variables | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV" | |
echo "repository_name=$(basename `git rev-parse --show-toplevel`)" >> "$GITHUB_ENV" | |
echo "platform=$(echo ${{ matrix.platform }} | tr -d '/' | tr -d 'linux')" >> "$GITHUB_ENV" | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . # Docker context (path to Dockerfile and build context) | |
platforms: ${{ matrix.platform }} | |
file: ./Dockerfile # Path to Dockerfile (if not in the root) | |
push: false # Push the built image to a registry # ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.repository_name }}:${{ env.sha_short }}-${{ env.platform }} |