trigger build on tags
name: Publish Docker image
on:
- release:
- types: [published]
+ schedule:
+ - cron: '0 10 * * *' # everyday at 10am
+ push:
+ branches:
+ - '**'
+ tags:
+ - '*.*.*'
+ pull_request:
+ branches:
+ - 'main'
env:
REGISTRY: ghcr.io
@@ -25,6 +33,7 @@ jobs:
uses: actions/checkout@v2
- name: Log in to the Container registry
+ if: github.event_name != 'pull_request'
uses: docker/login-action@v1.10.0
with:
registry: ${{ env.REGISTRY }}
@@ -36,11 +45,19 @@ jobs:
uses: docker/metadata-action@v3.4.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ tags: |
+ type=schedule
+ type=ref,event=branch
+ type=ref,event=pr
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
+ type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v2.6.1
with:
context: .
- push: true
+ push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
\ No newline at end of file
