summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiran Tal <liran.tal@gmail.com>2021-07-05 10:01:03 +0300
committerGitHub <noreply@github.com>2021-07-05 10:01:03 +0300
commitdac5740ef4deb9bcd11cf54871a3832b8f93d68d (patch)
tree84c40a371ab233295908edb57f042ea4bf3a7507
parent6568b08ce93bd27911ac9f23528653c286fdb876 (diff)
ci: push Docker image to Docker Hub
-rw-r--r--.github/workflows/docker-publish-to-dockerhub.yml57
1 files changed, 57 insertions, 0 deletions
diff --git a/.github/workflows/docker-publish-to-dockerhub.yml b/.github/workflows/docker-publish-to-dockerhub.yml
new file mode 100644
index 0000000..7dcddb4
--- /dev/null
+++ b/.github/workflows/docker-publish-to-dockerhub.yml
@@ -0,0 +1,57 @@
+name: "Docker: Docker Hub"
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+on:
+ schedule:
+ - cron: '0 12 * * 1'
+ push:
+ branches: [ main ]
+ tags: [ 'v*.*.*' ]
+ pull_request:
+ branches: [ main ]
+
+env:
+ REGISTRY: docker.io
+ IMAGE_NAME: ${{ github.repository_owner }}/dockly
+
+jobs:
+ build_and_publish:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Log into registry ${{ env.REGISTRY }}
+ if: github.event_name != 'pull_request'
+ uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Extract Docker metadata
+ id: meta
+ uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ flavor: |
+ latest=true
+ prefix=
+ suffix=
+
+ - name: Build and push Docker image
+ uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+ with:
+ context: .
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}