|
| 1 | +name: Build demo apps |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'apps/**' |
| 9 | + |
| 10 | +jobs: |
| 11 | + hello-world: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + packages: write |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: setup qemu |
| 22 | + uses: docker/setup-qemu-action@v3 |
| 23 | + |
| 24 | + - name: setup docker |
| 25 | + uses: docker/setup-buildx-action@v3 |
| 26 | + |
| 27 | + - name: login to ghcr.io |
| 28 | + uses: docker/login-action@v3 |
| 29 | + with: |
| 30 | + registry: ghcr.io |
| 31 | + username: ${{ github.actor }} |
| 32 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: docker metadata |
| 35 | + uses: docker/metadata-action@v5 |
| 36 | + id: hello_world_meta |
| 37 | + with: |
| 38 | + images: | |
| 39 | + ghcr.io/${{ github.repository }}/apps/hello-world |
| 40 | + tags: | |
| 41 | + type=sha,format=long |
| 42 | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} |
| 43 | +
|
| 44 | + - name: build and push |
| 45 | + uses: docker/build-push-action@v5 |
| 46 | + with: |
| 47 | + context: /apps/hello-world |
| 48 | + platforms: linux/amd64,linux/arm64 |
| 49 | + push: true |
| 50 | + tags: ${{ steps.hello_world_meta.outputs.tags }} |
| 51 | + labels: ${{ steps.hello_world_meta.outputs.labels }} |
| 52 | + |
| 53 | + probes: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + permissions: |
| 56 | + contents: read |
| 57 | + packages: write |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: checkout |
| 61 | + uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: setup qemu |
| 64 | + uses: docker/setup-qemu-action@v3 |
| 65 | + |
| 66 | + - name: setup docker |
| 67 | + uses: docker/setup-buildx-action@v3 |
| 68 | + |
| 69 | + - name: login to ghcr.io |
| 70 | + uses: docker/login-action@v3 |
| 71 | + with: |
| 72 | + registry: ghcr.io |
| 73 | + username: ${{ github.actor }} |
| 74 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + |
| 76 | + - name: docker metadata |
| 77 | + uses: docker/metadata-action@v5 |
| 78 | + id: probe_meta |
| 79 | + with: |
| 80 | + images: | |
| 81 | + ghcr.io/${{ github.repository }}/apps/probes |
| 82 | + tags: | |
| 83 | + type=sha,format=long |
| 84 | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} |
| 85 | +
|
| 86 | + - name: build and push |
| 87 | + uses: docker/build-push-action@v5 |
| 88 | + with: |
| 89 | + context: /apps/probes |
| 90 | + platforms: linux/amd64,linux/arm64 |
| 91 | + push: true |
| 92 | + tags: ${{ steps.probe_meta.outputs.tags }} |
| 93 | + labels: ${{ steps.probe_meta.outputs.labels }} |
| 94 | + |
| 95 | + blue-green: |
| 96 | + runs-on: ubuntu-latest |
| 97 | + permissions: |
| 98 | + contents: read |
| 99 | + packages: write |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: checkout |
| 103 | + uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: setup qemu |
| 106 | + uses: docker/setup-qemu-action@v3 |
| 107 | + |
| 108 | + - name: setup docker |
| 109 | + uses: docker/setup-buildx-action@v3 |
| 110 | + |
| 111 | + - name: login to ghcr.io |
| 112 | + uses: docker/login-action@v3 |
| 113 | + with: |
| 114 | + registry: ghcr.io |
| 115 | + username: ${{ github.actor }} |
| 116 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 117 | + |
| 118 | + - name: docker metadata (blue) |
| 119 | + uses: docker/metadata-action@v5 |
| 120 | + id: blue_meta |
| 121 | + with: |
| 122 | + |
| 123 | + images: | |
| 124 | + ghcr.io/${{ github.repository }}/apps/blue-green |
| 125 | + tags: | |
| 126 | + type=sha,format=long |
| 127 | + type=raw,value=blue |
| 128 | +
|
| 129 | + - name: docker metadata (green) |
| 130 | + uses: docker/metadata-action@v5 |
| 131 | + id: green_meta |
| 132 | + with: |
| 133 | + images: | |
| 134 | + ghcr.io/${{ github.repository }}/apps/blue-green |
| 135 | + tags: | |
| 136 | + type=sha,format=long |
| 137 | + type=raw,value=green |
| 138 | +
|
| 139 | + - name: build and push (blue) |
| 140 | + uses: docker/build-push-action@v5 |
| 141 | + with: |
| 142 | + context: /apps/blue-green |
| 143 | + platforms: linux/amd64,linux/arm64 |
| 144 | + build-args: | |
| 145 | + IS_BLUE=true |
| 146 | + push: true |
| 147 | + tags: ${{ steps.green_meta.outputs.tags }} |
| 148 | + labels: ${{ steps.green_meta.outputs.labels }} |
| 149 | + |
| 150 | + - name: build and push (green) |
| 151 | + uses: docker/build-push-action@v5 |
| 152 | + with: |
| 153 | + context: /apps/blue-green |
| 154 | + platforms: linux/amd64,linux/arm64 |
| 155 | + build-args: | |
| 156 | + IS_BLUE=false |
| 157 | + push: true |
| 158 | + tags: ${{ steps.green_meta.outputs.tags }} |
| 159 | + labels: ${{ steps.green_meta.outputs.labels }} |
| 160 | + |
0 commit comments