fix: add verbose output and exclude problematic directories during ta… #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Server | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: corepack enable | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Set up Nuxt UI Pro license | |
run: | | |
echo "NUXT_UI_PRO_LICENSE=${{ secrets.NUXT_UI_PRO_LICENSE }}" > .env | |
env: | |
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }} | |
- name: Install dependencies | |
run: npm install | |
- name: Build Nuxt.js app | |
run: npm run build | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- 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: Compress Files | |
run: tar -czvf deploy.tar.gz --exclude='./node_modules' --exclude='./.git' --warning=no-file-changed . | |
- name: Copy Tarball via SCP | |
run: scp deploy.tar.gz ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:${{ secrets.SERVER_DEPLOY_PATH }} | |
- name: Extract Tarball on Server | |
run: | | |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'EOF' | |
cd ${{ secrets.SERVER_DEPLOY_PATH }} | |
tar -xzf deploy.tar.gz | |
rm deploy.tar.gz | |
sudo docker-compose up -d --build | |
EOF |