|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
name: Build and push containers
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
# Automatically triggered by a testing workflow passing
|
|
|
|
|
workflow_run:
|
|
|
|
|
workflows: ["ChangeDetection.io Test"]
|
|
|
|
|
types: [completed]
|
|
|
|
|
|
|
|
|
|
# Or a new tagged release
|
|
|
|
|
release:
|
|
|
|
|
types: [created, published, edited]
|
|
|
|
|
|
|
|
|
@ -26,6 +28,8 @@ jobs:
|
|
|
|
|
|
|
|
|
|
on-success:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
# If the testing workflow has a success, then we build to :latest
|
|
|
|
|
# Or if we are in a tagged release scenario.
|
|
|
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }} || ${{ github.event.release.tag_name }} != ''
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
@ -74,6 +78,7 @@ jobs:
|
|
|
|
|
version: latest
|
|
|
|
|
driver-opts: image=moby/buildkit:master
|
|
|
|
|
|
|
|
|
|
# master always builds :latest
|
|
|
|
|
- name: Build and push :latest
|
|
|
|
|
id: docker_build
|
|
|
|
|
if: ${{ github.ref == 'refs/heads/master'}}
|
|
|
|
@ -89,17 +94,18 @@ jobs:
|
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
|
|
|
|
|
|
|
|
# A new tagged release is required, which builds :tag
|
|
|
|
|
- name: Build and push :tag
|
|
|
|
|
id: docker_build_tag_release
|
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
|
if: ${{ github.event.release.tag_name }} != ''
|
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
|
with:
|
|
|
|
|
context: ./
|
|
|
|
|
file: ./Dockerfile
|
|
|
|
|
push: true
|
|
|
|
|
tags: |
|
|
|
|
|
${{ secrets.DOCKER_HUB_USERNAME }}/changedetection.io:${{ steps.tagName.outputs.tag }}
|
|
|
|
|
ghcr.io/dgtlmoon/changedetection.io:${{ steps.tagName.outputs.tag }}
|
|
|
|
|
${{ secrets.DOCKER_HUB_USERNAME }}/changedetection.io:${{ github.event.release.tag_name }}
|
|
|
|
|
ghcr.io/dgtlmoon/changedetection.io:${{ github.event.release.tag_name }}
|
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
|
|
|