@@ -3,9 +3,13 @@ name: Publish Container
33on :
44 push :
55 branches :
6- - expansion
6+ - main
77 workflow_dispatch :
88
9+ concurrency :
10+ group : landing-production
11+ cancel-in-progress : false
12+
913permissions :
1014 contents : read
1115 packages : write
4145 tags : |
4246 type=ref,event=branch
4347 type=sha,prefix=sha-
44- type=raw,value=latest,enable=${{ github.ref_name == 'expansion ' }}
48+ type=raw,value=latest,enable=${{ github.ref_name == 'main ' }}
4549
4650 - name : Build and push image
51+ id : build
4752 uses : docker/build-push-action@v7
4853 with :
4954 context : .
5358 labels : ${{ steps.meta.outputs.labels }}
5459 cache-from : type=gha
5560 cache-to : type=gha,mode=max
61+
62+ - name : Configure restricted deployment key
63+ env :
64+ VPS_DEPLOY_KEY : ${{ secrets.VPS_DEPLOY_KEY }}
65+ VPS_HOST_KEY : ${{ secrets.VPS_HOST_KEY }}
66+ run : |
67+ install -d -m 0700 ~/.ssh
68+ printf '%s\n' "$VPS_DEPLOY_KEY" > ~/.ssh/landing_deploy
69+ printf '%s\n' "$VPS_HOST_KEY" > ~/.ssh/known_hosts
70+ chmod 0600 ~/.ssh/landing_deploy ~/.ssh/known_hosts
71+
72+ - name : Deploy landing only
73+ env :
74+ IMAGE_DIGEST : ${{ steps.build.outputs.digest }}
75+ VPS_HOST : ${{ secrets.VPS_HOST }}
76+ VPS_USER : ${{ secrets.VPS_USER }}
77+ run : |
78+ started_ms=$(date +%s%3N)
79+ image="ghcr.io/${GITHUB_REPOSITORY}@${IMAGE_DIGEST}"
80+ printf 'TIMING deploy_request_started_at=%s\n' "$(date --iso-8601=milliseconds)"
81+ ssh \
82+ -i ~/.ssh/landing_deploy \
83+ -o BatchMode=yes \
84+ -o IdentitiesOnly=yes \
85+ "${VPS_USER}@${VPS_HOST}" \
86+ "deploy-landing ${image} ${GITHUB_SHA} ${GITHUB_RUN_ID}"
87+ printf 'TIMING deploy_request_ms=%s\n' "$(( $(date +%s%3N) - started_ms ))"
0 commit comments