Previously a devops push would re-deploy prod-stack against whatever :main was cached locally on the host, silently reverting recent frontend/api rolls. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
name: Deploy stacks
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: docker stack deploy
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
username: root
|
|
host: ${{ secrets.SSH_KNOWN_HOSTS }}
|
|
key: ${{ secrets.SSH_PRIV_KEY }}
|
|
script: |
|
|
cd ~/devops && git pull
|
|
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
docker pull ghcr.io/token-for-token/hosted-gateway:main
|
|
docker pull ghcr.io/token-for-token/hosted-gateway-frontend:main
|
|
docker stack deploy -c ~/devops/hostinger/system-stack.yaml system --with-registry-auth --resolve-image always
|
|
docker stack deploy -c ~/devops/hostinger/prod-stack.yaml prod --with-registry-auth --resolve-image always
|
|
|
|
- name: prune old images
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
username: root
|
|
host: ${{ secrets.SSH_KNOWN_HOSTS }}
|
|
key: ${{ secrets.SSH_PRIV_KEY }}
|
|
script: |
|
|
docker image prune -f --filter "until=24h"
|