-
-
Notifications
You must be signed in to change notification settings - Fork 140
206 lines (191 loc) · 6.63 KB
/
build.yml
File metadata and controls
206 lines (191 loc) · 6.63 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
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
---
name: Build
on: # yamllint disable-line rule:truthy
merge_group:
types:
- checks_requested
pull_request:
push:
branches:
- develop
- develop-*
release:
types:
- edited
- published
schedule:
- cron: 0 10 * * * # everyday at 10am
workflow_dispatch:
# Set a default shell for any run steps. The `-Eueo pipefail` sets errtrace,
# nounset, errexit, and pipefail. The `-x` will print all commands as they are
# run. Please see the GitHub Actions documentation for more information:
# https://docs.github.com/en/actions/using-jobs/setting-default-values-for-jobs
defaults:
run:
shell: bash -Eueo pipefail -x {0}
concurrency:
group: >-
${{ github.workflow }}-${{
github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
packages: write
id-token: write
attestations: write
security-events: write
jobs:
diagnostics:
name: Diagnostics
uses: felddy/reusable-workflows/.github/workflows/diagnostics.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
config:
name: Config
uses: ./.github/workflows/_config.yml
lint:
name: Lint
uses: felddy/reusable-workflows/.github/workflows/common-lint.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
build:
name: Build and Publish Container
needs:
- config
- lint
- diagnostics
# Skip registry-pushing jobs on fork PRs — secrets are unavailable and
# GITHUB_TOKEN is read-only, so pushes would fail with auth errors.
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
uses: felddy/reusable-workflows/.github/workflows/container-build.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
with:
platforms: ${{ needs.config.outputs.platforms }}
image-name: ${{ needs.config.outputs.image_name }}
context: .
dockerfile: ./Dockerfile
scan-severity: CRITICAL,HIGH
build-preinstalled:
name: Build and Publish Container Pre-Installed
needs:
- config
- lint
- diagnostics
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
uses: felddy/reusable-workflows/.github/workflows/container-build.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
with:
build-secret-1-name: foundry_password
build-secret-2-name: foundry_username
cache-scope: preinstall # prevent preinstall from skipping from regular build cache
platforms: ${{ needs.config.outputs.test_platforms }}
image-name: ${{ needs.config.outputs.image_name_preinstall }}
context: .
dockerfile: ./Dockerfile
scan-severity: "" # don't fail on vulns in FoundryVTT binaries
upload-scan-results: false # don't pollute repo security tab with third-party vulns
secrets:
private-package-token: ${{ secrets.PRIVATE_PACKAGE_TOKEN }}
build-secret-1: ${{ secrets.FOUNDRY_PASSWORD }}
build-secret-2: ${{ secrets.FOUNDRY_USERNAME }}
test:
name: Test Container
needs:
- config
- build
uses: felddy/reusable-workflows/.github/workflows/container-test.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
permissions:
actions: read
contents: read
packages: read
with:
image-name: ${{ needs.config.outputs.image_name }}
platforms: ${{ needs.config.outputs.test_platforms }}
test-secret-1-name: FOUNDRY_USERNAME
test-secret-2-name: FOUNDRY_PASSWORD
secrets:
test-secret-1: ${{ secrets.FOUNDRY_USERNAME }}
test-secret-2: ${{ secrets.FOUNDRY_PASSWORD }}
test-preinstalled:
name: Test Container Pre-Installed
needs:
- config
- build-preinstalled
uses: felddy/reusable-workflows/.github/workflows/container-test.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
permissions:
actions: read
contents: read
packages: read
with:
image-name: ${{ needs.config.outputs.image_name_preinstall }}
platforms: ${{ needs.config.outputs.test_platforms }}
secrets:
registry-token: ${{ secrets.PRIVATE_PACKAGE_TOKEN }}
publish-manifest:
name: Publish Manifest
needs:
- config
- build
- test
- test-preinstalled
uses: felddy/reusable-workflows/.github/workflows/container-publish-manifest.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
permissions:
actions: read
contents: read
packages: write
id-token: write
attestations: write
with:
image-name: ${{ needs.config.outputs.image_name }}
platforms: ${{ needs.config.outputs.platforms }}
publish-manifest-preinstalled:
name: Publish Manifest Pre-Installed
needs:
- config
- build-preinstalled
- test
- test-preinstalled
uses: felddy/reusable-workflows/.github/workflows/container-publish-manifest.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
permissions:
actions: read
contents: read
packages: write
id-token: write
attestations: write
with:
image-name: ${{ needs.config.outputs.image_name_preinstall }}
platforms: ${{ needs.config.outputs.test_platforms }}
secrets:
private-package-token: ${{ secrets.PRIVATE_PACKAGE_TOKEN }}
mirror-to-dockerhub:
name: Mirror images to DockerHub
needs:
- publish-manifest
- publish-manifest-preinstalled
- config
if: github.event_name == 'release' && !github.event.release.prerelease
permissions:
contents: read
packages: read
uses: felddy/reusable-workflows/.github/workflows/container-mirror.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
with:
image_name: ${{ needs.config.outputs.image_name }}
image_tag_names: ${{ needs.publish-manifest.outputs.image-tag-names }}
target_registry: docker.io
secrets:
target-registry-username: ${{ secrets.DOCKER_USERNAME }}
target-registry-password: ${{ secrets.DOCKER_PASSWORD }}
publish-readme:
name: Publish docs to DockerHub
needs:
- publish-manifest
- publish-manifest-preinstalled
- config
if: |
github.event_name == 'release' &&
!github.event.release.prerelease &&
needs.publish-manifest.outputs.is-latest == 'true'
uses: felddy/reusable-workflows/.github/workflows/dockerhub-description.yml@d586f3254330e18d4433661e60aee74c0ca0e26c # tag=v4.1.0
with:
image_name: ${{ needs.config.outputs.image_name }}
secrets:
docker_password: ${{ secrets.DOCKER_PASSWORD }}
docker_username: ${{ secrets.DOCKER_USERNAME }}