Skip to content

Commit 1aa3e85

Browse files
authored
Push to docker hub on commit (#20)
* Create docker-publish.yml * updates * updates * updates * update
1 parent 537bde0 commit 1aa3e85

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Docker
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
schedule:
10+
- cron: '19 17 * * *'
11+
push:
12+
branches: [ main ]
13+
# Publish semver tags as releases.
14+
tags: [ '*.*.*' ]
15+
pull_request:
16+
branches: [ main ]
17+
18+
env:
19+
# Use docker.io for Docker Hub if empty
20+
REGISTRY: docker.io
21+
# github.repository as <account>/<repo>
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
25+
jobs:
26+
build:
27+
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
packages: write
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v2
36+
37+
# Login against a Docker registry except on PR
38+
# https://github.com/docker/login-action
39+
- name: Log into dockerhub
40+
if: github.event_name != 'pull_request'
41+
uses: docker/login-action@v1
42+
with:
43+
username: ${{ secrets.DOCKERHUB_USERNAME }}
44+
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
45+
46+
# Extract metadata (tags, labels) for Docker
47+
# https://github.com/docker/metadata-action
48+
- name: Extract Docker metadata
49+
id: meta
50+
uses: docker/metadata-action@v3
51+
with:
52+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
53+
54+
# Build and push Docker image with Buildx (don't push on PR)
55+
# https://github.com/docker/build-push-action
56+
- name: Build and push Docker image
57+
uses: docker/build-push-action@v2
58+
with:
59+
context: parse/.
60+
push: ${{ github.event_name != 'pull_request' }}
61+
tags: ${{ steps.meta.outputs.tags }}
62+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)