-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (91 loc) · 2.92 KB
/
Copy pathbuild.yaml
File metadata and controls
107 lines (91 loc) · 2.92 KB
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
name: Build Document
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
skip_release:
type: boolean
description: Do not create a release from this run
default: false
env:
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: thesis-builder
jobs:
build-and-push-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: 'main'
fetch-depth: 0
fetch-tags: true
- name: Check for Docker changes
id: changes
run: |
if git diff --name-only $(git describe --abbrev=0 --tags $(git describe --abbrev=0)^) $(git describe --abbrev=0) | grep -P '^(\.devcontainer/(?!devcontainer\.json).+)|(\.github/workflows/build.yaml)'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Log in to Container registry
if: ${{ steps.changes.outputs.changed == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
if: ${{ steps.changes.outputs.changed == 'true' }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up Docker Buildx
if: ${{ steps.changes.outputs.changed == 'true' }}
uses: docker/setup-buildx-action@v3
- name: Build Docker image
if: ${{ steps.changes.outputs.changed == 'true' }}
id: push
uses: docker/build-push-action@v6
with:
push: true
file: .devcontainer/Dockerfile
context: .devcontainer
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
if: ${{ steps.changes.outputs.changed == 'true' }}
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
build-latex:
runs-on: ubuntu-24.04
needs: build-and-push-image
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run latexmk
run: |
./build.sh -w ${{ github.workspace }}
- name: Create Release
uses: softprops/action-gh-release@v2
if: ${{ ! github.event.inputs.skip_release }}
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
files: |
dist/*.pdf