Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.

Commit 1396d43

Browse files
Create docker-publish.yml
1 parent 54e3c69 commit 1396d43

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/docker-publish.yml

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: '35 19 * * *'
11+
push:
12+
branches: [ master ]
13+
# Publish semver tags as releases.
14+
tags: [ 'v*.*.*' ]
15+
pull_request:
16+
branches: [ master ]
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+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
30+
packages: write
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v2
35+
36+
# Login against a Docker registry except on PR
37+
# https://github.com/docker/login-action
38+
- name: Log into registry ${{ env.REGISTRY }}
39+
if: github.event_name != 'pull_request'
40+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
41+
with:
42+
registry: ${{ env.REGISTRY }}
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_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@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
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@ad44023a93711e3deb337508980b4b5e9bcdc5dc
58+
with:
59+
context: .
60+
push: ${{ github.event_name != 'pull_request' }}
61+
tags: ${{ steps.meta.outputs.tags }}
62+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)