-
-
Notifications
You must be signed in to change notification settings - Fork 209
61 lines (58 loc) · 2.03 KB
/
mirror.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
name: Mirror Dependencies
# We mirror upstream container images like Migra, imgproxy, etc. because these
# are usually only available on certain image registry and not others (e.g. only
# on Docker Hub and not on ghcr.io or AWS ECR).
#
# For container images that we control, we usually publish to Docker Hub,
# ghcr.io, and AWS ECR.
on:
# We can't trigger the mirror job on PR merge because certain tests would fail
# until we mirror some images. E.g. a PR to update the imgproxy image version
# would fail, because there is a test that creates a container from the
# updated image version, which would fail because the image hasn't been
# mirrored yet. It's a catch-22!
#
# TODO: Make the cli start test run *after* we mirror images (if needed).
pull_request_review:
types:
- submitted
paths:
- ".github/workflows/mirror.yml"
- "internal/utils/misc.go"
- "tools/listdep/**"
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.review.state == 'approved' }}
outputs:
tags: ${{ steps.list.outputs.tags }}
curr: ${{ steps.curr.outputs.tags }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- id: list
run: |
echo "tags=$(go run tools/listdep/main.go)" >> $GITHUB_OUTPUT
- id: curr
name: List main branch dependencies
if: github.ref != 'refs/heads/main'
run: |
git fetch origin main
git checkout main
echo "tags=$(go run tools/listdep/main.go)" >> $GITHUB_OUTPUT
publish:
needs:
- setup
if: ${{ needs.setup.outputs.tags != needs.setup.outputs.curr }}
strategy:
matrix:
src: ${{ fromJson(needs.setup.outputs.tags) }}
# Call workflow explicitly because events from actions cannot trigger more actions
uses: ./.github/workflows/mirror-image.yml
with:
image: ${{ matrix.src }}
secrets: inherit