-
Notifications
You must be signed in to change notification settings - Fork 516
94 lines (89 loc) · 3.05 KB
/
Copy pathcli-go-publish-migra.yml
File metadata and controls
94 lines (89 loc) · 3.05 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
name: Publish migra
on:
workflow_dispatch:
permissions:
contents: read
jobs:
settings:
runs-on: ubuntu-latest
outputs:
image_tag: supabase/migra:${{ steps.version.outputs.migra }}
steps:
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
load: true
context: https://github.com/djrobstep/migra.git
tags: supabase/migra:builder
- id: version
# Replace space with equal to get the raw version string, ie. migra=3.0.1663481299
run: |
docker run --rm -a STDOUT supabase/migra:builder pip show migra \
| grep 'Version' \
| sed -E 's/Version: (.*)/migra=\1/g' \
>> $GITHUB_OUTPUT
shell: bash
build_image:
needs:
- settings
strategy:
matrix:
include:
- runner: [ self-hosted, X64 ]
arch: amd64
- runner: arm-runner
arch: arm64
runs-on: ${{ matrix.runner }}
timeout-minutes: 180
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- run: docker context create builders
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
with:
endpoint: builders
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: build
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
push: true
context: https://github.com/djrobstep/migra.git
tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
cache-from: type=gha,scope=${{ github.ref_name }}-migra-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-migra-${{ matrix.arch
}}
merge_manifest:
needs:
- settings
- build_image
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Merge multi-arch manifests
env:
IMAGE_TAG: ${{ needs.settings.outputs.image_tag }}
run: |
docker buildx imagetools create -t "${IMAGE_TAG}" \
"${IMAGE_TAG}_amd64" \
"${IMAGE_TAG}_arm64"
publish:
needs:
- settings
- merge_manifest
# Call workflow explicitly because events from actions cannot trigger more actions
uses: ./.github/workflows/cli-go-mirror-image.yml
with:
image: ${{ needs.settings.outputs.image_tag }}
secrets:
PROD_AWS_ROLE: ${{ secrets.PROD_AWS_ROLE }}
defaults:
run:
working-directory: apps/cli-go