feat: simultaneously build p2w-relay/attest.

also use meta to tag the image.
This commit is contained in:
Eran Davidovich 2021-12-22 16:39:44 +02:00
parent 3162d40110
commit 4da43d2651
2 changed files with 59 additions and 16 deletions

View File

@ -1,10 +1,14 @@
name: build docker image
name: build attest docker image
on:
push:
branches:
- "master"
tags:
- "v*"
pull_request:
branches:
- "master"
jobs:
docker:
@ -13,14 +17,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/p2w-attest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@ -30,18 +37,9 @@ jobs:
uses: docker/build-push-action@v2
with:
platforms: linux/amd64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/p2w-attest:${{ steps.vars.outputs.sha_short }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: p2w-attest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push p2w-relay
uses: docker/build-push-action@v2
with:
platforms: linux/amd64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/p2w-relay:${{ steps.vars.outputs.sha_short }}
target: p2w-relay
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -0,0 +1,45 @@
name: build relay docker image
on:
push:
branches:
- "master"
tags:
- "v*"
pull_request:
branches:
- "master"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/p2w-relay
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push p2w-relay
uses: docker/build-push-action@v2
with:
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: p2w-relay
cache-from: type=gha
cache-to: type=gha,mode=max