77 push :
88 tags :
99 - v*
10- env :
11- ARTIFACT_PATH : /tmp/artifact.tar
12- BOX_NAME : web-server
13- BOX_URL : idea2app/web-server
14-
1510jobs :
1611 deploy_docker_image :
1712 name : Deploy Docker image
@@ -20,48 +15,41 @@ jobs:
2015 packages : write
2116 contents : read
2217 steps :
23- - uses : actions/checkout@v4
18+ - uses : actions/checkout@v5
2419
2520 - name : Inject Environment variables
2621 run : |
27- echo "BOX_NAME=${BOX_NAME@L}" >> "${GITHUB_ENV}"
28- echo "BOX_URL=${BOX_URL@L}" >> "${GITHUB_ENV}"
2922 cat > .env.local <<EOF
3023 ${{ secrets.ENV_FILE }}
3124 EOF
32- - uses : docker/setup-qemu-action@v3
33- - uses : docker/setup-buildx-action@v3
25+ cp .env .env.personal.local
3426
35- - name : Build Image
36- uses : docker/build-push-action@v6
27+ 3728 with :
38- context : .
39- platforms : linux/amd64
40- tags : ${{ env.BOX_URL }}:latest
41- outputs : type=docker,dest=${{ env.ARTIFACT_PATH }}
42-
43- - name : Pick Docker Compose
44- run : |
45- mkdir ./build
46- mv ${{ env.ARTIFACT_PATH }} ./docker-compose.yml ./start.sh ./build
29+ registry : ghcr.io
30+ username : ${{ github.actor }}
31+ password : ${{ github.token }}
4732
48- - name : Transport Image
49- 33+ 34+ id : meta
5035 with :
51- source : ./build/*.*
52- target : /tmp
53- host : ${{ secrets.HOST }}
54- username : ${{ secrets.USER }}
55- password : ${{ secrets.SSH_KEY }}
56- strip_components : 1
36+ images : ghcr.io/${{ github.repository }}
5737
58- - name : Run Image
59- uses : garygrossgarten/github-action-ssh@release
38+ - uses : docker/build-push-action@v6
39+ id : push
6040 with :
61- host : ${{ secrets.HOST }}
62- username : ${{ secrets.USER }}
63- password : ${{ secrets.SSH_KEY }}
64- command : |
65- mv /tmp/docker-compose.yml /tmp/start.sh ~/
66- chmod +x ~/start.sh
67- echo '${{ secrets.SSH_KEY }}' | sudo -S ~/start.sh ${{ env.ARTIFACT_PATH }}
41+ context : .
42+ push : true
43+ tags : ${{ steps.meta.outputs.tags }}
44+ labels : ${{ steps.meta.outputs.labels }}
45+
46+ - name : deploy to NorthFlank
47+ env :
48+ PROJECT_ID : idea2app-service
49+ SERVICE_ID : idea2app-web
50+ run : |
51+ curl --request POST \
52+ --header "Authorization: Bearer ${{ secrets.NORTHFLANK_API_KEY }}" \
53+ --header "Content-Type: application/json" \
54+ --data '{"docker":{"configType":"default"},"external":{"credentials":"idea2app-github","imagePath":"ghcr.io/${{ github.repository }}:latest"}}' \
55+ https://api.northflank.com/v1/projects/$PROJECT_ID/services/$SERVICE_ID/deployment
0 commit comments