Skip to content

Commit

Permalink
More robust CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Jul 14, 2024
1 parent 456c594 commit 67dbe45
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/build-flavor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:

jobs:
build:
name: Build image
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -41,17 +42,21 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[registry."docker.io"]
mirrors = ["mirror.gcr.io"]
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
load: true
build-args: |
KOTLIN_VERSION=${{ inputs.kotlin-version }}
BASE_IMAGE=${{ inputs.base-image }}
Expand All @@ -64,7 +69,7 @@ jobs:
run: |
mkdir -p "$SCRIPTS_DIR"
echo 'java.io.File("/scripts/test.ok").writeText("OK")' > "$SCRIPTS_DIR/test.kts"
docker run --rm -v "$SCRIPTS_DIR:/scripts/" "$REGISTRY_IMAGE" /scripts/test.kts
docker run --rm -v "$SCRIPTS_DIR:/scripts/" ${{ steps.build.outputs.imageid }} /scripts/test.kts
[ -f scripts/test.ok ]; # fails the step if file does not exist
- name: Export digest
run: |
Expand All @@ -86,7 +91,8 @@ jobs:
if-no-files-found: error
retention-days: 1

merge:
publish:
name: Publish to Docker Hub
runs-on: ubuntu-latest
needs: build
if: ${{ !inputs.only-validate }}
Expand Down

0 comments on commit 67dbe45

Please sign in to comment.