Skip to content

fix: deployment

fix: deployment #57

Workflow file for this run

name: Deploy to server
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Nuxt UI Pro license

Check failure on line 19 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 19
run: |
echo "NUXT_UI_PRO_LICENSE=${{ secrets.NUXT_UI_PRO_LICENSE }}" > .env
env:
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
- name: Build Docker image
run: |
docker buildx build --platform linux/amd64 -t bluescript:latest .
- name: Save Docker image as tarball
run: |
docker save bluescript:latest | gzip > bluescript.tar.gz
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add server to known_hosts
run: ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Transfer Docker image to server
run: |
scp bluescript.tar.gz ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:${{ secrets.SERVER_DEPLOY_PATH }}
- name: Deploy Docker container on server
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'ENDSSH'
cd ${{ secrets.SERVER_DEPLOY_PATH }}
gunzip -c bluescript.tar.gz | sudo docker load
sudo docker stop bluescript || true
sudo docker rm bluescript || true
sudo docker run -d --name bluescript --network web bluescript:latest
sudo docker system prune -f --volumes
ENDSSH