Fixed docker authentication #17
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: "Build the images, also push them if merged on main" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
strategy: | |
max-parallel: 9 | |
matrix: | |
target: | |
- { directory: rhel, label: "π§ Glibc build images" } | |
- { directory: musl, label: "π§ Musl (dynamic) build images" } | |
- { directory: linux-static, label: "π§ Musl (static) build images" } | |
- { directory: cross, label: "π¦ππ₯οΈ Cross compilation images" } | |
- { directory: test, label: "π¦ Test image" } | |
- { directory: release, label: "π¦ Release image" } | |
- { directory: sql_server, label: "π’οΈ SQL Server images" } | |
- { directory: mongo, label: "π Mongo single-replica images" } | |
- { directory: cockroach, label: "πͺ³ CockroachDB custom images" } | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "Build ${{matrix.target.label}}" | |
run: | | |
echo "Building ${{matrix.target.label}}" | |
cd "${{matrix.target.directory}}" | |
make build | |
push: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
strategy: | |
max-parallel: 9 | |
matrix: | |
target: | |
- { directory: rhel, label: "π§ Glibc build images" } | |
- { directory: musl, label: "π§ Musl (dynamic) build images" } | |
- { directory: linux-static, label: "π§ Musl (static) build images" } | |
- { directory: cross, label: "π¦ππ₯οΈ Cross compilation images" } | |
- { directory: test, label: "π¦ Test image" } | |
- { directory: release, label: "π¦ Release image" } | |
- { directory: sql_server, label: "π’οΈ SQL Server images" } | |
- { directory: mongo, label: "π Mongo single-replica images" } | |
- { directory: cockroach, label: "πͺ³ CockroachDB custom images" } | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "Build and push ${{matrix.target.label}}" | |
env: | |
DOCKER_HUB_USERNAME: ${{secrets.DOCKER_HUB_USERNAME}} | |
DOCKER_HUB_TOKEN: ${{secrets.DOCKER_HUB_TOKEN}} | |
run: | | |
echo "Building and pushing ${{matrix.target.label}}" | |
cd "${{matrix.target.directory}}" | |
make build | |
echo "$DOCKER_HUB_TOKEN" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin | |
make push |