File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed
Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 1- name : Build Production Image
1+ name : CI / Build Production Image
22
3- # Auto-build on push to main (no deploy, just build)
3+ # Tests run automatically on push to main
4+ # Docker build only runs when manually triggered
45on :
56 push :
67 branches : [main]
8+ workflow_dispatch :
79
810env :
911 REGISTRY : ghcr.io
10- IMAGE_NAME : ${{ github.repository }}
1112
1213jobs :
1314 test :
@@ -32,12 +33,18 @@ jobs:
3233 name : Build & Push Docker Image
3334 runs-on : ubuntu-latest
3435 needs : test
36+ # Only run on manual trigger
37+ if : github.event_name == 'workflow_dispatch'
3538 permissions :
3639 contents : read
3740 packages : write
3841 steps :
3942 - uses : actions/checkout@v4
4043
44+ - name : Repository name to lowercase
45+ id : repo
46+ run : echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
47+
4148 - name : Get version
4249 id : version
4350 run : echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
5865 context : .
5966 push : true
6067 tags : |
61- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
62- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
63- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
68+ ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:latest
69+ ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:${{ steps.version.outputs.VERSION }}
70+ ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:${{ github.sha }}
6471 build-args : |
6572 VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL_PROD }}
6673 VITE_SUPABASE_PUBLISHABLE_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY_PROD }}
Original file line number Diff line number Diff line change @@ -114,9 +114,14 @@ jobs:
114114 packages : write
115115 outputs :
116116 version : ${{ steps.version.outputs.VERSION }}
117+ image_name : ${{ steps.repo.outputs.name }}
117118 steps :
118119 - uses : actions/checkout@v4
119120
121+ - name : Repository name to lowercase
122+ id : repo
123+ run : echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
124+
120125 - name : Get version
121126 id : version
122127 run : echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
@@ -137,8 +142,8 @@ jobs:
137142 context : .
138143 push : true
139144 tags : |
140- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
141- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
145+ ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:latest
146+ ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:${{ steps.version.outputs.VERSION }}
142147 build-args : |
143148 VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL_PROD }}
144149 VITE_SUPABASE_PUBLISHABLE_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY_PROD }}
@@ -196,5 +201,5 @@ jobs:
196201
197202 **Docker Image:**
198203 ```
199- docker pull ghcr.io/${{ github.repository }}:${{ needs.build-and-push.outputs.version }}
204+ docker pull ghcr.io/${{ needs.build-and-push.outputs.image_name }}:${{ needs.build-and-push.outputs.version }}
200205 ```
You can’t perform that action at this time.
0 commit comments