-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (184 loc) · 7.45 KB
/
build-latex-base.yaml
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: build_push_latex_base_img
on:
release:
types: [published]
push:
branches:
- main
paths:
- LaTexBase/**
- .github/workflows/build-latex-base.yaml
jobs:
build_latex_amd64:
name: Build and publish LaTex image (amd64)
runs-on: ubuntu-24.04
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate package repo name
id: ghcr_repo
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-latex-base" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ steps.ghcr_repo.outputs.path }}
- name: Get current commit SHA short
id: commit_sha
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Manually generate sha tag
id: tag_sha
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT
- name: Manually generate head tag
id: tag_head
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:head" >> $GITHUB_OUTPUT
- name: Manually generate ver tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
id: tag_ver
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build and push Docker images for each commit
uses: docker/build-push-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
context: ./LaTexBase
platforms: linux/amd64
push: true
tags: |
${{ steps.tag_sha.outputs.tag }}-amd64
${{ steps.tag_head.outputs.tag }}-amd64
labels: ${{ steps.meta.outputs.labels }}
- name: Create and push a manifest with ver referencing version
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
docker buildx imagetools create \
-t ${{ steps.tag_ver.outputs.tag }}-amd64 \
${{ steps.tag_head.outputs.tag }}-amd64
build_latex_arm64:
name: Build and publish LaTex image (arm64)
runs-on: ubuntu-24.04-arm
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate package repo name
id: ghcr_repo
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-latex-base" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ steps.ghcr_repo.outputs.path }}
- name: Get current commit SHA short
id: commit_sha
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Manually generate sha tag
id: tag_sha
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT
- name: Manually generate head tag
id: tag_head
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:head" >> $GITHUB_OUTPUT
- name: Manually generate ver tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
id: tag_ver
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build and push Docker images for each commit
uses: docker/build-push-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
context: ./LaTexBase
platforms: linux/arm64
push: true
tags: |
${{ steps.tag_sha.outputs.tag }}-arm64
${{ steps.tag_head.outputs.tag }}-arm64
labels: ${{ steps.meta.outputs.labels }}
- name: Create and push a manifest with ver referencing version
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
docker buildx imagetools create \
-t ${{ steps.tag_ver.outputs.tag }}-arm64 \
${{ steps.tag_head.outputs.tag }}-arm64
push_multi_arch_manifest:
name: Push Docker multi-arch manifest to Container registry
needs: [build_latex_amd64, build_latex_arm64]
runs-on: ubuntu-24.04
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate package repo name
id: ghcr_repo
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-latex-base" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ steps.ghcr_repo.outputs.path }}
- name: Get current commit SHA short
id: commit_sha
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Manually generate sha tag
id: tag_sha
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT
- name: Manually generate head tag
id: tag_head
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:head" >> $GITHUB_OUTPUT
- name: Manually generate ver tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
id: tag_ver
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create and push a manifest referencing git sha
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
docker buildx imagetools create \
-t ${{ steps.tag_sha.outputs.tag }} \
${{ steps.tag_sha.outputs.tag }}-arm64 \
${{ steps.tag_sha.outputs.tag }}-amd64
- name: Create and push a manifest referencing git head
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
docker buildx imagetools create \
-t ${{ steps.tag_head.outputs.tag }} \
${{ steps.tag_head.outputs.tag }}-arm64 \
${{ steps.tag_head.outputs.tag }}-amd64
- name: Create and push a manifest with ver referencing version
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
docker buildx imagetools create \
-t ${{ steps.tag_ver.outputs.tag }} \
${{ steps.tag_ver.outputs.tag }}-arm64 \
${{ steps.tag_ver.outputs.tag }}-amd64