name: docker-image on: push: branches: - main release: types: - published jobs: images: runs-on: ubuntu-latest strategy: matrix: build: - fromImage: scratch tagPrefix: "" - fromImage: alpine:latest tagPrefix: "alpine-" steps: - name: Get current date run: echo "curr_date=$(date --utc +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Quay uses: docker/login-action@v2 with: registry: quay.io username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Login to ghcr.io uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v3 - name: Modify Dockerfile run: | sed -i -e "s|FROM scratch|FROM ${{ matrix.build.fromImage }}|g" Dockerfile - name: Build and push ${{github.event.release.tag_name }} id: docker_build_release uses: docker/build-push-action@v3 if: ${{ github.event.release.tag_name != '' }} with: context: . pull: true push: true tags: quay.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}latest,quay.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}${{ github.event.release.tag_name }},ghcr.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}latest,ghcr.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}${{ github.event.release.tag_name }} platforms: linux/amd64,linux/arm64,linux/arm/v7 build-args: | VERSION=${{ github.event.release.tag_name }} BUILD=${{ env.curr_date }} - name: Build and push main id: docker_build_main uses: docker/build-push-action@v3 if: ${{ github.event.release.tag_name == '' }} with: context: . pull: true push: true tags: quay.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}main,ghcr.io/bakito/adguardhome-sync:${{ matrix.build.tagPrefix }}main platforms: linux/amd64,linux/arm64,linux/arm/v7 build-args: | VERSION=main BUILD=${{ env.curr_date }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} test: needs: images runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Create kind cluster uses: helm/kind-action@v1.3.0 with: version: v0.14.0 kubectl_version: v1.24.0 - name: Install Helm Chart run: ./testdata/e2e/bin/install-chart.sh - name: Wait for sync to finish run: ./testdata/e2e/bin/wait-for-sync.sh - name: Show origin Logs run: ./testdata/e2e/bin/show-origin-logs.sh - name: Show Replica Logs run: ./testdata/e2e/bin/show-replica-logs.sh - name: Show Sync Logs run: ./testdata/e2e/bin/show-sync-logs.sh