2626 REGISTRY : ghcr.io
2727 # github.repository as <account>/<repo>
2828 IMAGE_NAME : ${{ github.repository }}
29+ MIGRATE_IMAGE_NAME : ${{ github.repository }}-migrate
2930
3031jobs :
3132 build :
8586 type=semver,pattern={{major}}
8687 type=raw,value=latest,enable={{is_default_branch}}
8788
89+ - name : Extract Docker metadata (migrate)
90+ id : meta-migrate
91+ uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
92+ with :
93+ images : ${{ env.REGISTRY }}/${{ env.MIGRATE_IMAGE_NAME }}
94+ tags : |
95+ type=ref,event=branch
96+ type=ref,event=pr
97+ type=semver,pattern={{version}}
98+ type=semver,pattern={{major}}.{{minor}}
99+ type=semver,pattern={{major}}
100+ type=raw,value=latest,enable={{is_default_branch}}
101+
88102 # Extract version from git tag or ref
89103 # Uses git describe to get latest tag + commit hash in SemVer format: 1.2.3+abc1234
90104 - name : Extract version
@@ -138,6 +152,22 @@ jobs:
138152 cache-from : type=gha
139153 cache-to : type=gha,mode=max
140154
155+ - name : Build and push migrate Docker image
156+ id : build-and-push-migrate
157+ uses : docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
158+ with :
159+ context : .
160+ file : apps/web/Dockerfile
161+ target : migrate
162+ push : ${{ github.event_name != 'pull_request' }}
163+ platforms : linux/amd64,linux/arm64
164+ tags : ${{ steps.meta-migrate.outputs.tags }}
165+ labels : ${{ steps.meta-migrate.outputs.labels }}
166+ build-args : |
167+ APP_VERSION=${{ steps.version.outputs.version }}
168+ cache-from : type=gha
169+ cache-to : type=gha,mode=max
170+
141171 # Sign the resulting Docker image digest except on PRs.
142172 # This will only write to the public Rekor transparency log when the Docker
143173 # repository is public to avoid leaking data. If you would like to publish
@@ -152,3 +182,10 @@ jobs:
152182 # This step uses the identity token to provision an ephemeral certificate
153183 # against the sigstore community Fulcio instance.
154184 run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
185+
186+ - name : Sign the published migrate Docker image
187+ if : ${{ github.event_name != 'pull_request' }}
188+ env :
189+ TAGS : ${{ steps.meta-migrate.outputs.tags }}
190+ DIGEST : ${{ steps.build-and-push-migrate.outputs.digest }}
191+ run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
0 commit comments