Skip to content

Deploy

Deploy #21

Workflow file for this run

name: Deploy
on:
# push:
# branches: [master]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}:latest
- name: Deploy to server
run: |
echo "${{ secrets.DEPLOY_KEY }}" > ssh_key
chmod 600 ssh_key
ssh -i ssh_key -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
echo "${{ secrets.GITHUB_TOKEN }}" \
| docker login ghcr.io \
--username "${{ github.actor }}" \
--password-stdin
docker pull ghcr.io/${{ github.repository }}:latest
docker stop githem-api || true
docker rm githem-api || true
docker run -d --name githem-api -p 42069:42069 -p 42070:42070 --restart unless-stopped ghcr.io/${{ github.repository }}:latest
EOF