Skip to content

Commit 15fe524

Browse files
committed
Add CI workflows
1 parent 5a18857 commit 15fe524

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/workflows/docker-image.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Build the Docker image
18+
run: docker build . --file Dockerfile --tag docker-supervisord:$(date +%s)

.github/workflows/docker-publish.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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: '16 1 * * *'
11+
push:
12+
branches: [ main ]
13+
# Publish semver tags as releases.
14+
tags: [ 'v*.*.*' ]
15+
pull_request:
16+
branches: [ main ]
17+
18+
env:
19+
# Use docker.io for Docker Hub if empty
20+
REGISTRY: ghcr.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+
# This is used to complete the identity challenge
33+
# with sigstore/fulcio when running outside of PRs.
34+
id-token: write
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
# Workaround: https://github.com/docker/build-push-action/issues/461
41+
- name: Setup Docker buildx
42+
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
43+
44+
# Login against a Docker registry except on PR
45+
# https://github.com/docker/login-action
46+
- name: Log into registry ${{ env.REGISTRY }}
47+
if: github.event_name != 'pull_request'
48+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
49+
with:
50+
registry: ${{ env.REGISTRY }}
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
54+
# Extract metadata (tags, labels) for Docker
55+
# https://github.com/docker/metadata-action
56+
- name: Extract Docker metadata
57+
id: meta
58+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
59+
with:
60+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61+
62+
# Build and push Docker image with Buildx (don't push on PR)
63+
# https://github.com/docker/build-push-action
64+
- name: Build and push Docker image
65+
id: build-and-push
66+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
67+
with:
68+
context: .
69+
push: ${{ github.event_name != 'pull_request' }}
70+
tags: ${{ steps.meta.outputs.tags }}
71+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)