-
-
Notifications
You must be signed in to change notification settings - Fork 61
92 lines (80 loc) · 2.73 KB
/
docker_hub.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# This is a basic workflow to help you get started with Actions
name: Publish Image to Docker Registries
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
push:
branches:
- development
paths-ignore:
- "docs/**"
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Docker Platforms For Branch
run: |
if [[ $GITHUB_REF == 'refs/heads/development' ]]; then
echo "DOCKER_PLATFORMS=linux/amd64" >> "$GITHUB_ENV"
else
echo "DOCKER_PLATFORMS=linux/amd64,linux/arm64,linux/arm" >> "$GITHUB_ENV"
fi
- name: Set Docker Metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
evanbuss/openbooks
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
# 'latest' when push to master with tag
# 'edge' when push to development
# '1.1.1' when push version tag v1.1.1
flavor: |
latest=auto
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=edge,branch=development
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
install: true
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
platforms: ${{ env.DOCKER_PLATFORMS }}
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: evanbuss/openbooks
short-description: IRC Highway eBook Downloads
readme-filepath: ./docker.md