|
8 | 8 | type: string
|
9 | 9 |
|
10 | 10 | env:
|
11 |
| - REGISTRY: ghcr.io |
12 |
| - ORG: cosmos |
13 |
| - IMAGE_NAME: ibc-go-wasm-simd |
14 |
| - GIT_TAG: "${{ inputs.tag }}" |
| 11 | + REGISTRY: ghcr.io |
| 12 | + ORG: cosmos |
| 13 | + IMAGE_NAME: ibc-go-wasm-simd |
| 14 | + GIT_TAG: "${{ inputs.tag }}" |
15 | 15 |
|
16 | 16 | jobs:
|
17 |
| - build-image-at-tag: |
18 |
| - runs-on: ubuntu-latest |
19 |
| - steps: |
20 |
| - - uses: actions/checkout@v4 |
21 |
| - with: |
22 |
| - ref: "${{ env.GIT_TAG }}" |
23 |
| - fetch-depth: 0 |
24 |
| - - uses: actions/setup-python@v5 |
25 |
| - with: |
26 |
| - python-version: '3.10' |
27 |
| - - name: Install dependencies |
28 |
| - run: make python-install-deps |
29 |
| - - name: Log in to the Container registry |
30 |
| - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 |
31 |
| - with: |
32 |
| - registry: ${{ env.REGISTRY }} |
33 |
| - username: ${{ github.actor }} |
34 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
35 |
| - - name: Build image |
36 |
| - run: | |
37 |
| - version="$(scripts/get-libwasm-version.py --get-version)" |
38 |
| - checksum="$(scripts/get-libwasm-version.py --get-checksum)" |
39 |
| - |
40 |
| - # remove all `/` or `+` characters from the docker tag and replace them with a -. |
41 |
| - # this ensures the docker tag is valid. |
42 |
| - docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" |
43 |
| - docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" -f modules/light-clients/08-wasm/Dockerfile --build-arg LIBWASM_VERSION=${version} --build-arg LIBWASM_CHECKSUM=${checksum} |
44 |
| - docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" |
| 17 | + build-image-at-tag: |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: ubuntu-24.04 |
| 23 | + platform: linux/amd64 |
| 24 | + - os: ubuntu-24.04-arm |
| 25 | + platform: linux/arm64 |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + ref: "${{ env.GIT_TAG }}" |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + # TODO: #7885 Get rid of this script, it is super unecessary and can probably be done in the Dockerfile or a bash script |
| 34 | + - uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: '3.10' |
| 37 | + - name: Install dependencies |
| 38 | + run: make python-install-deps |
| 39 | + - name: Get arguments |
| 40 | + run: echo "LIBWASM_VERSION=$(scripts/get-libwasm-version.py --get-version)" >> $GITHUB_ENV |
| 41 | + |
| 42 | + - name: Set up Docker Buildx |
| 43 | + uses: docker/setup-buildx-action@v3 |
| 44 | + |
| 45 | + - name: Log in to the Container registry |
| 46 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 |
| 47 | + with: |
| 48 | + registry: ${{ env.REGISTRY }} |
| 49 | + username: ${{ github.actor }} |
| 50 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
| 52 | + - name: Build and push |
| 53 | + id: build |
| 54 | + uses: docker/build-push-action@v6 |
| 55 | + with: |
| 56 | + platforms: ${{ matrix.platform }} |
| 57 | + file: modules/light-clients/08-wasm/Dockerfile |
| 58 | + build-args: LIBWASM_VERSION=${{ env.LIBWASM_VERSION }} |
| 59 | + outputs: type=image,"name=${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}",push-by-digest=true,name-canonical=true,push=true |
| 60 | + |
| 61 | + - name: Export digest |
| 62 | + run: | |
| 63 | + mkdir -p ${{ runner.temp }}/digests |
| 64 | + digest="${{ steps.build.outputs.digest }}" |
| 65 | + touch "${{ runner.temp }}/digests/${digest#sha256:}" |
| 66 | +
|
| 67 | + - name: Upload digest |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: digests-${{ matrix.os }} # If we end up running more builds on the same OS, we need to differentiate more here |
| 71 | + path: ${{ runner.temp }}/digests/* |
| 72 | + if-no-files-found: error |
| 73 | + retention-days: 1 |
| 74 | + |
| 75 | + merge: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + needs: |
| 78 | + - build-image-at-tag |
| 79 | + steps: |
| 80 | + - name: Download digests |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + path: ${{ runner.temp }}/digests |
| 84 | + pattern: digests-* |
| 85 | + merge-multiple: true |
| 86 | + |
| 87 | + - name: Get docker tag |
| 88 | + # remove all `/` or `+` characters from the docker tag and replace them with a -. |
| 89 | + # this ensures the docker tag is valid. |
| 90 | + run: echo "DOCKER_TAG=$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" >> $GITHUB_ENV |
| 91 | + |
| 92 | + - name: Log in to the Container registry |
| 93 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 |
| 94 | + with: |
| 95 | + registry: ${{ env.REGISTRY }} |
| 96 | + username: ${{ github.actor }} |
| 97 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + |
| 99 | + - name: Create manifest list and push |
| 100 | + working-directory: ${{ runner.temp }}/digests |
| 101 | + run: | |
| 102 | + docker buildx imagetools create --tag ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }} $(printf '${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}@sha256:%s ' *) |
0 commit comments