Split previous docker test CI into one for PRs and one for triggering the main buildx workflow that deploys new images to Docker Hub. Note that this needs to be further refactored soon to use reusable workflows. The main portion of docker/docker-compose tests is duplicated between the new main + test workflows.
44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
name: buildx
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["docker_main"]
|
|
branches: [main]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
on-success:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Wait for tests to succeed
|
|
if: ${{ github.event.workflow_run.conclusion != 'success' }}
|
|
run: exit 1
|
|
- name: checkout code
|
|
uses: actions/checkout@v2
|
|
- name: install buildx
|
|
id: buildx
|
|
uses: crazy-max/ghaction-docker-buildx@v1
|
|
with:
|
|
version: latest
|
|
- name: log in to docker hub
|
|
run: |
|
|
echo "${{ secrets.DOCKER_PASSWORD }}" | \
|
|
docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
|
- name: build and push the image
|
|
if: startsWith(github.ref, 'refs/heads/main') && github.actor == 'benbusby'
|
|
run: |
|
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
docker buildx ls
|
|
docker buildx build --push \
|
|
--tag benbusby/whoogle-search:latest \
|
|
--platform linux/amd64,linux/arm/v7,linux/arm64 .
|
|
- name: build and push tag
|
|
if: startsWith(github.ref, 'refs/tags')
|
|
run: |
|
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
docker buildx ls
|
|
docker buildx build --push \
|
|
--tag benbusby/whoogle-search:${GITHUB_REF#refs/*/v}\
|
|
--platform linux/amd64,linux/arm/v7,linux/arm64 .
|