|
| 1 | +name: publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ['main'] |
| 6 | + release: |
| 7 | + types: ['published'] |
| 8 | + |
| 9 | +concurrency: ${{ github.ref }} |
| 10 | + |
| 11 | +env: |
| 12 | + REGISTRY: ghcr.io |
| 13 | + IMAGE_NAME: cloudstruct/cardano-node |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-amd64: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - name: login |
| 24 | + uses: docker/login-action@v1 |
| 25 | + with: |
| 26 | + registry: ${{ env.REGISTRY }} |
| 27 | + username: ${{ github.actor }} |
| 28 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + - id: meta |
| 30 | + uses: docker/metadata-action@v3 |
| 31 | + with: |
| 32 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 33 | + tags: | |
| 34 | + type=schedule,suffix=-amd64 |
| 35 | + type=ref,event=branch,suffix=-amd64 |
| 36 | + type=ref,event=tag,suffix=-amd64 |
| 37 | + type=ref,event=pr,suffix=-amd64 |
| 38 | + - name: push |
| 39 | + uses: docker/build-push-action@v2 |
| 40 | + with: |
| 41 | + context: . |
| 42 | + push: true |
| 43 | + tags: ${{ steps.meta.outputs.tags }} |
| 44 | + labels: ${{ steps.meta.outputs.labels }} |
| 45 | + cache-from: type=gha |
| 46 | + cache-to: type=gha,mode=max |
| 47 | + build-arm64: |
| 48 | + runs-on: self-hosted |
| 49 | + permissions: |
| 50 | + contents: read |
| 51 | + packages: write |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + - name: login |
| 55 | + uses: docker/login-action@v1 |
| 56 | + with: |
| 57 | + registry: ${{ env.REGISTRY }} |
| 58 | + username: ${{ github.actor }} |
| 59 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + - id: meta |
| 61 | + uses: docker/metadata-action@v3 |
| 62 | + with: |
| 63 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 64 | + tags: | |
| 65 | + type=schedule,suffix=-arm64v8 |
| 66 | + type=ref,event=branch,suffix=-arm64v8 |
| 67 | + type=ref,event=tag,suffix=-arm64v8 |
| 68 | + type=ref,event=pr,suffix=-arm64v8 |
| 69 | + - name: push |
| 70 | + uses: docker/build-push-action@v2 |
| 71 | + with: |
| 72 | + context: . |
| 73 | + push: true |
| 74 | + tags: ${{ steps.meta.outputs.tags }} |
| 75 | + labels: ${{ steps.meta.outputs.labels }} |
| 76 | + cache-from: type=gha |
| 77 | + cache-to: type=gha,mode=max |
| 78 | + multi-arch-manifest: |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: [build-amd64, build-arm64] |
| 81 | + permissions: |
| 82 | + contents: read |
| 83 | + packages: write |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v2 |
| 86 | + - name: login |
| 87 | + uses: docker/login-action@v1 |
| 88 | + with: |
| 89 | + registry: ${{ env.REGISTRY }} |
| 90 | + username: ${{ github.actor }} |
| 91 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + - id: meta |
| 93 | + uses: docker/metadata-action@v3 |
| 94 | + with: |
| 95 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 96 | + tags: | |
| 97 | + type=ref,event=branch |
| 98 | + type=ref,event=tag |
| 99 | + - name: manifest |
| 100 | + run: docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} --amend ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-amd64 --amend ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-arm64v8 |
| 101 | + - name: push |
| 102 | + run: docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} |
0 commit comments