Skip to content

feat: add minio.atomize.ink #17

feat: add minio.atomize.ink

feat: add minio.atomize.ink #17

Workflow file for this run

name: Deploy to Batman Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code (for access to docker-compose-reverseproxy.yaml and nginx.conf)
uses: actions/checkout@v4
- name: Connect to Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:batman-ci
- name: Copy nginx.conf to Batman Server
uses: appleboy/scp-action@v0.1.7
with:
source: "docker-compose-reverseproxy.yaml,nginx.conf"
target: /home/${{ secrets.BATMAN_SERVER_USER}}/
host: ${{ secrets.BATMAN_SERVER_IP }}
username: ${{ secrets.BATMAN_SERVER_USER }}
key: ${{ secrets.BATMAN_SERVER_SSH_KEY }}
- name: Deploy to Batman Server
uses: appleboy/ssh-action@v0.1.0
with:
host: ${{ secrets.BATMAN_SERVER_IP }}
username: ${{ secrets.BATMAN_SERVER_USER }}
key: ${{ secrets.BATMAN_SERVER_SSH_KEY }}
port: 22
script: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker compose -f docker-compose-reverseproxy.yaml up -d
- name: List and remove non-latest images in Batman Server
uses: appleboy/ssh-action@v0.1.0
with:
host: ${{ secrets.BATMAN_SERVER_IP }}
username: ${{ secrets.BATMAN_SERVER_USER }}
key: ${{ secrets.BATMAN_SERVER_SSH_KEY }}
port: 22
script: |
images=$(docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}' | grep -v ':latest')
echo "Images to be removed:"
echo "$images"
while IFS= read -r image; do
repo_tag=$(echo $image | awk '{print $1}')
image_id=$(echo $image | awk '{print $2}')
echo "Removing image $repo_tag with ID $image_id"
docker rmi "$image_id" || true
done <<< "$images"