@@ -49,14 +49,15 @@ jobs:
4949 needs : check-migrations
5050 runs-on : ubuntu-latest
5151 steps :
52- - name : Configure staging host authenticity
52+ - &ssh-host-auth
53+ name : Configure staging host authenticity
5354 run : |
5455 mkdir -p ~/.ssh/ && chmod 700 ~/.ssh/
5556 touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
5657 echo "$SSH_HOSTKEY" > ~/.ssh/known_hosts
5758 env :
5859 SSH_HOSTKEY : ${{ secrets.STAGING_HOSTKEY }}
59-
60+
6061 - name : Deploy to staging
6162 run : |
6263 eval $(ssh-agent -s)
@@ -67,16 +68,36 @@ jobs:
6768 cp ~/.env-staging dashboard-staging/.env &&
6869 cd dashboard-staging &&
6970 git checkout ${GITHUB_SHA} &&
70- docker compose up --build --pull=always --remove-orphans --detach &&
71- docker image prune -fa --filter "until=48h" &&
72- docker volume ls --filter dangling=true --format "::warning::volume {{.Name}} is dangling" &&
73- docker container ls -f status=exited --format "::warning::container {{.ID}} {{.Status}} ({{.Names}})"
71+ docker compose pull --ignore-buildable --policy=always &&
72+ docker compose build --no-cache &&
73+ docker compose up -d --remove-orphans
7474 "
7575 env :
7676 SSH_USER : ${{ secrets.STAGING_USER }}
7777 SSH_HOST : ${{ secrets.STAGING_HOST }}
7878 SSH_KEY : ${{ secrets.STAGING_KEY }}
7979
80+ cleanup :
81+ needs : deploy-staging
82+ runs-on : ubuntu-latest
83+ steps :
84+ - *ssh-host-auth
85+ - name : Prune docker artifacts on remote
86+ env :
87+ SSH_USER : ${{ secrets.STAGING_USER }}
88+ SSH_HOST : ${{ secrets.STAGING_HOST }}
89+ SSH_KEY : ${{ secrets.STAGING_KEY }}
90+ run : |
91+ eval $(ssh-agent -s)
92+ echo "$SSH_KEY" | ssh-add - >/dev/null
93+ ssh "${SSH_USER}@${SSH_HOST}" <<<'EOF'
94+ set -eu
95+ docker image prune -fa --filter "until=48h"
96+ docker builder prune -f --filter "until=48h"
97+ docker volume ls --filter dangling=true --format "::warning::volume {{.Name}} is dangling"
98+ docker container ls --filter status=exited --format "::warning::container {{.ID}} {{.Status}} ({{.Names}})"
99+ EOF
100+
80101 e2e-tests :
81102 runs-on : ubuntu-latest
82103 timeout-minutes : 10
0 commit comments