-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (63 loc) · 2.08 KB
/
push.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
# Build and publish the container and use it to render the PDF for pushes to main.
name: push
on:
push:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Set up QEMU for cross-platform builds below
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and publish Docker image
uses: docker/build-push-action@v5
with:
# Cache layers from the container repo.
# Update the cache only on pushes to main.
# This minimizes the amount of times we have to rebuild pandoc.
cache-from: type=gha
cache-to: ${{ github.event_name == 'push' && 'type=gha' || '' }}
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Use the fresh container to render the samples.
render-samples:
needs: build-container
uses: ./.github/workflows/render.yml
with:
container-version: latest
input: guide.tcg
workflow: push