diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 57771e0..de78d20 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -2,88 +2,88 @@ name: Build and publish Docker images for Energy Tracker on: push: - branches: [ "staging" ] + branches: [ "staging", "main" ] + pull_request: + branches: [ "staging", "main" ] env: REGISTRY: ghcr.io PROVER_IMAGE_NAME: ${{ github.repository }} STREAMR_IMAGE_NAME: ${{ github.repository }}/streamr-client - jobs: - build-and-push-prover-image: + build-and-push-images: runs-on: ubuntu-latest permissions: contents: read packages: write attestations: write id-token: write + steps: - name: Checkout repository uses: actions/checkout@v5 - - name: Log in to the Container registry + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry if: github.event_name != 'pull_request' - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + + # Build and push Prover image (energy-tracker) + - name: Extract metadata for Prover image + id: meta-prover + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }} - - name: Build and push Docker image - id: push - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + + - name: Build and push Prover image + uses: docker/build-push-action@v6 with: context: . + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - name: Generate artifact attestation + tags: ${{ steps.meta-prover.outputs.tags }} + labels: ${{ steps.meta-prover.outputs.labels }} + + - name: Generate attestation for Prover image if: github.event_name != 'pull_request' uses: actions/attest-build-provenance@v3 with: subject-name: ${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }} - subject-digest: ${{ steps.push.outputs.digest }} + subject-digest: ${{ steps.build-and-push-prover.outputs.digest }} push-to-registry: true - build-and-push-streamr-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - attestations: write - id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - name: Log in to the Container registry - if: github.event_name != 'pull_request' - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + # Build and push Streamr client image + - name: Extract metadata for Streamr client image + id: meta-streamr + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }} - - name: Build and push Docker image - id: push - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + + - name: Build and push Streamr client image + uses: docker/build-push-action@v6 with: context: ./streamr-client + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Generate artifact attestation + tags: ${{ steps.meta-streamr.outputs.tags }} + labels: ${{ steps.meta-streamr.outputs.labels }} + + - name: Generate attestation for Streamr client image if: github.event_name != 'pull_request' uses: actions/attest-build-provenance@v3 with: subject-name: ${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true \ No newline at end of file + subject-digest: ${{ steps.build-and-push-streamr.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/docker-image-prover.yml b/.github/workflows/docker-image-prover.yml deleted file mode 100644 index 20e5f2b..0000000 --- a/.github/workflows/docker-image-prover.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Create and publish Prover Docker image - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - attestations: write - id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - name: Log in to the Container registry - if: github.event_name != 'pull_request' - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - id: push - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Generate artifact attestation - if: github.event_name != 'pull_request' - uses: actions/attest-build-provenance@v3 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true diff --git a/.github/workflows/docker-image-streamr-client.yml b/.github/workflows/docker-image-streamr-client.yml deleted file mode 100644 index 914a3ba..0000000 --- a/.github/workflows/docker-image-streamr-client.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Create and publish Prover streamr client image - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}/streamr-client - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - attestations: write - id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - name: Log in to the Container registry - if: github.event_name != 'pull_request' - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - id: push - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - with: - context: ./streamr-client - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Generate artifact attestation - if: github.event_name != 'pull_request' - uses: actions/attest-build-provenance@v3 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true