-
Notifications
You must be signed in to change notification settings - Fork 76
161 lines (138 loc) · 5.7 KB
/
docker-release.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Publish to Docker Hub (Release)
on:
release:
types:
- published
branches: master
jobs:
docker-release-build:
name: Build docker image
strategy:
matrix:
include:
- arch: 'amd64'
dockerfile: 'Dockerfile'
- arch: 'arm64'
dockerfile: 'Dockerfile.aarch64'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: "${{ github.ref }}"
submodules: recursive
fetch-depth: 0 # This is set to download the full git history for the repo
- name: Replace Sentry DSN and other keys
shell: pwsh
run: |
./.github/workflows/ReplaceSentryDSN.ps1 -dsn ${{ secrets.SENTRY_DSN }}
./.github/workflows/ReplaceTmdbApiKey.ps1 -apiKey ${{ secrets.TMDB_API }}
./.github/workflows/ReplaceAVD3URL.ps1 -url ${{ secrets.AVD3_URL }}
- name: Get release info
id: release_info
uses: revam/gh-action-get-tag-and-version@v1
with:
tag: "${{ github.ref }}"
prefix: v
prefixRegex: "[vV]?"
- uses: docker/setup-qemu-action@v2
name: Set up QEMU
with:
platforms: arm64
if: ${{ matrix.arch == 'arm64' }}
- uses: docker/setup-buildx-action@v2
name: Set up Docker Buildx
- uses: docker/login-action@v2
name: Log into GitHub Container Registry
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v2
name: Log into Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Disabled provenance for now, until it works with docker manifest create.
# The manifest list produced by the new feature is incompatible with the
# expected format used in the docker manifest create command.
- uses: docker/build-push-action@v4
name: Build and Push the Docker image
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: |
ghcr.io/${{ secrets.DOCKER_REPO }}:latest-${{ matrix.arch }}
ghcr.io/${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}-${{ matrix.arch }}
${{ secrets.DOCKER_REPO }}:latest-${{ matrix.arch }}
${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}-${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
build-args: |
version=${{ steps.release_info.outputs.version }}
channel=stable
commit=${{ github.sha }}
date=${{ steps.release_info.outputs.date }}
tag=${{ steps.release_info.outputs.tag }}
provenance: false
docker-release-push_manifest_latest:
runs-on: ubuntu-latest
name: Push combined latest tag for both images
needs:
- docker-release-build
steps:
- uses: docker/login-action@v2
name: Log into GitHub Container Registry
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v2
name: Log into Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create manifest
run: |
docker manifest create ghcr.io/${{ secrets.DOCKER_REPO }}:latest --amend ghcr.io/${{ secrets.DOCKER_REPO }}:latest-amd64 --amend ghcr.io/${{ secrets.DOCKER_REPO }}:latest-arm64
docker manifest create ${{ secrets.DOCKER_REPO }}:latest --amend ${{ secrets.DOCKER_REPO }}:latest-amd64 --amend ${{ secrets.DOCKER_REPO }}:latest-arm64
- name: Push manifest
run: |
docker manifest push ghcr.io/${{ secrets.DOCKER_REPO }}:latest
docker manifest push ${{ secrets.DOCKER_REPO }}:latest
docker-release-push_manifest_version:
runs-on: ubuntu-latest
name: Push combined versioned tag for both images
needs:
- docker-release-build
steps:
- uses: actions/checkout@master
with:
ref: "${{ github.ref }}"
submodules: recursive
fetch-depth: 0 # This is set to download the full git history for the repo
- name: Get release info
id: release_info
uses: revam/gh-action-get-tag-and-version@v1
with:
tag: "${{ github.ref }}"
prefix: v
prefixRegex: "[vV]?"
- uses: docker/login-action@v2
name: Log into GitHub Container Registry
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v2
name: Log into Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create manifest
run: |
docker manifest create ghcr.io/${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }} --amend ghcr.io/${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}-amd64 --amend ghcr.io/${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}-arm64
docker manifest create ${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }} --amend ${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}-amd64 --amend ${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}-arm64
- name: Push manifest
run: |
docker manifest push ghcr.io/${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}
docker manifest push ${{ secrets.DOCKER_REPO }}:${{ steps.release_info.outputs.tag }}