55 branches :
66 - main
77 tags :
8- - ' v* '
8+ - " v* "
99 workflow_dispatch :
1010
1111env :
12- IMAGE_NAME : pypsa-app
1312 REGISTRY : ghcr.io
13+ FULL_IMAGE_NAME : ghcr.io/pypsa/pypsa-app
1414
1515jobs :
16- push-full- image :
17- name : Build and push full image
16+ push-image :
17+ name : Build and push image
1818 runs-on : ubuntu-latest
1919 permissions :
2020 contents : read
@@ -38,16 +38,17 @@ jobs:
3838 id : meta
3939 uses : docker/metadata-action@v5
4040 with :
41- images : ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
41+ images : ${{ env.FULL_IMAGE_NAME }}
4242 tags : |
4343 type=ref,event=branch
4444 type=ref,event=tag
4545 type=semver,pattern={{version}}
4646 type=semver,pattern={{major}}.{{minor}}
4747 type=sha,prefix=
4848 type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
49+ type=raw,value=${{ github.event.repository.default_branch }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
4950
50- - name : Build and push full Docker image
51+ - name : Build and push Docker image
5152 uses : docker/build-push-action@v5
5253 with :
5354 context : .
@@ -56,12 +57,19 @@ jobs:
5657 push : true
5758 tags : ${{ steps.meta.outputs.tags }}
5859 labels : ${{ steps.meta.outputs.labels }}
60+ cache-from : type=gha
61+ cache-to : type=gha,mode=max
5962
60- - name : Image summary
61- run : |
62- echo "Image: \`${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}\`" >> $GITHUB_STEP_SUMMARY
63- echo "" >> $GITHUB_STEP_SUMMARY
64- echo "Tags:" >> $GITHUB_STEP_SUMMARY
65- echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
66- echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
67- echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
63+ deploy-to-dev :
64+ name : Deploy to dev server
65+ runs-on : ubuntu-latest
66+ needs : push-image
67+ steps :
68+ - name : Deploy via SSH
69+ 70+ with :
71+ host : ${{ secrets.SSH_HOST }}
72+ username : ${{ secrets.SSH_USER }}
73+ key : ${{ secrets.SSH_PRIVATE_KEY }}
74+ # Dummy command
75+ script : whoami
0 commit comments