diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 25eba612..ed7efaf4 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -1,7 +1,14 @@ name: Docker Image Build on: + schedule: + - cron: '0 10 * * *' # everyday at 10am push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: branches: - 'master' @@ -9,6 +16,20 @@ jobs: docker: runs-on: ubuntu-latest steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + # list of Docker images to use as base name for tags + images: | + jbtronics/part-db1 + ghcr.io/Part-DB/part-db1 + # add git short SHA as Docker tag + tag-sha: true - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -17,17 +38,24 @@ jobs: 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: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} - name: Build and push - id: docker_build uses: docker/build-push-action@v2 with: - push: true - tags: jbtronics/part-db1:latest - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} \ No newline at end of file + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} \ No newline at end of file