|
26 | 26 | runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} |
27 | 27 | container: amazonlinux:2023 |
28 | 28 |
|
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + |
29 | 32 | steps: |
30 | 33 | - run: dnf update -y && dnf install -y git tar gcc pkg-config openssl-devel |
31 | 34 |
|
|
50 | 53 | arch: [x86_64, aarch64] |
51 | 54 |
|
52 | 55 | permissions: |
| 56 | + contents: read |
53 | 57 | id-token: write |
54 | 58 |
|
55 | 59 | steps: |
|
76 | 80 | --output text |
77 | 81 | ) |
78 | 82 | echo "::notice::$LAYER_ARN" |
| 83 | +
|
| 84 | + docker: |
| 85 | + needs: build |
| 86 | + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' |
| 87 | + strategy: |
| 88 | + matrix: |
| 89 | + arch: [x86_64, aarch64] |
| 90 | + |
| 91 | + runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} |
| 92 | + |
| 93 | + permissions: |
| 94 | + contents: read |
| 95 | + id-token: write |
| 96 | + packages: write |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v6 |
| 100 | + - uses: docker/setup-buildx-action@v4 |
| 101 | + - uses: docker/login-action@v4 |
| 102 | + with: |
| 103 | + registry: ghcr.io |
| 104 | + username: ${{ github.repository_owner }} |
| 105 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + |
| 107 | + - uses: actions/download-artifact@v8 |
| 108 | + with: |
| 109 | + name: diet-lambda-${{ matrix.arch }} |
| 110 | + |
| 111 | + - uses: docker/build-push-action@v7 |
| 112 | + with: |
| 113 | + context: . |
| 114 | + push: true |
| 115 | + tags: ghcr.io/${{ github.repository }}:${{ matrix.arch }} |
| 116 | + |
| 117 | + multiarch: |
| 118 | + needs: docker |
| 119 | + runs-on: ubuntu-latest |
| 120 | + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' |
| 121 | + |
| 122 | + permissions: |
| 123 | + contents: read |
| 124 | + id-token: write |
| 125 | + packages: write |
| 126 | + |
| 127 | + steps: |
| 128 | + - uses: docker/setup-buildx-action@v4 |
| 129 | + - uses: docker/login-action@v4 |
| 130 | + with: |
| 131 | + registry: ghcr.io |
| 132 | + username: ${{ github.repository_owner }} |
| 133 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 134 | + |
| 135 | + - run: | |
| 136 | + docker buildx imagetools create \ |
| 137 | + --tag ghcr.io/${{ github.repository }}:latest \ |
| 138 | + ghcr.io/${{ github.repository }}:x86_64 \ |
| 139 | + ghcr.io/${{ github.repository }}:aarch64 |
0 commit comments