From d1976d9b099c80439b4d70fba06f222f21233637 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Thu, 27 Jun 2024 19:18:14 +0200 Subject: [PATCH] Fixing the pipeline to login and push always --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61a52615..c81594f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,9 @@ on: permissions: contents: read packages: write +env: + TEST_TAG: ${{ github.event.repository.name }}/rit-action:test + LATEST_TAG: ${{ github.event.repository.name }}/rit-action:latest jobs: build-push-rit-action-image: @@ -35,21 +38,41 @@ jobs: driver-opts: network=host platforms: linux/amd64 + - name: Build and export locally Docker + uses: docker/build-push-action@v6 + with: + context: .github/images + load: true + tags: ${{ env.TEST_TAG }} + + - name: Test the RIT Container Action + id: test-container + env: + RSKJ_BRANCH: 'master' + FEDERATOR_BRANCH: 'master' + run: | + docker run \ + --env RSKJ_BRANCH="${{ env.RSKJ_BRANCH }}" \ + --env FEDERATOR_BRANCH="${{ env.FEDERATOR_BRANCH }}" \ + --rm ${{ env.TEST_TAG }} + + - name: Build the RIT Action Container Image + uses: docker/build-push-action@v6 + with: + context: .github/images + tags: ${{ env.LATEST_TAG }} + labels: ${{ steps.meta.outputs.labels }} + - name: GitHub container registry login - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push the RIT Action Container Image - uses: docker/build-push-action@v6 - with: - context: .github/images - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Push RIT Action Container Image + run: | + docker push ${{ github.event.repository.name }}/rit-action:latest test-rit-action: needs: build-push-rit-action-image