48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
name: CI/CD Deploy Go-HTMX-SQLite App
|
|
|
|
# on:
|
|
# push:
|
|
# branches: [ "main" ]
|
|
|
|
# jobs:
|
|
# build-and-deploy:
|
|
# runs-on: ubuntu-latest
|
|
|
|
# steps:
|
|
# - name: Checkout code
|
|
# uses: actions/checkout@v4
|
|
|
|
# # Step 1: Log in to GHCR
|
|
# - name: Log in to GitHub Container Registry
|
|
# uses: docker/login-action@v2
|
|
# with:
|
|
# registry: ghcr.io
|
|
# username: ${{ github.actor }}
|
|
# password: ${{ secrets.GHCR_PAT }}
|
|
|
|
# # Step 2: Build Docker image
|
|
# - name: Build Docker image
|
|
# run: |
|
|
# docker build -t ghcr.io/dilankaher/my_website:latest .
|
|
|
|
# # Step 3: Push image to GHCR
|
|
# - name: Push Docker image
|
|
# run: |
|
|
# docker push ghcr.io/dilankaher/my_website:latest
|
|
|
|
# # Step 4: Deploy to server via SSH
|
|
# - name: Deploy to server
|
|
# uses: appleboy/ssh-action@v1
|
|
# with:
|
|
# host: ${{ secrets.SERVER_IP }}
|
|
# username: ${{ secrets.SERVER_USER }}
|
|
# key: ${{ secrets.SERVER_SSH_KEY }}
|
|
# script: |
|
|
# cd /home/dilanka/my_website
|
|
# git fetch https://${{ github.actor }}:${{ secrets.GHCR_PAT }}@github.com/DilankaHer/my_website.git main
|
|
# git checkout FETCH_HEAD -- docker-compose.yml my_website.db
|
|
# docker pull ghcr.io/dilankaher/my_website:latest
|
|
# docker compose down
|
|
# docker compose up -d
|
|
|