Skip to content

chore: login to dockerhub before use it #75

chore: login to dockerhub before use it

chore: login to dockerhub before use it #75

Workflow file for this run

name: Build and Push Docker Images
on:
push:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: "bash -Eeuo pipefail -x {0}"
jobs:
generate-jobs:
name: Generate Jobs
runs-on: ubuntu-latest
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Matrix
id: generate-jobs
run: |
strategy="$("./matrix.sh")"
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
jq . <<<"$strategy" # sanity check / debugging aid
build:
name: ${{ matrix.name }}
needs: generate-jobs
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
tags: ${{ matrix.tag }}
push: true
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.name }}