Repository navigation
Merge branch 'main' of https://github.com/YCP-Rev-Metrix/Wiki #98
This file contains hidden or 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: Wiki CI Workflow | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| repository_dispatch: | |
| types: [trigger-deploy] | |
| jobs: | |
| build_and_push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Login to Docker Hub | |
| run: echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin | |
| - name: Build and Push Docker Compose | |
| run: | | |
| docker compose -f docker-compose.yml build | |
| docker compose -f docker-compose.yml push | |
| deploy-server: | |
| runs-on: ubuntu-latest | |
| needs: [build_and_push] | |
| steps: | |
| # add necessary steps to SSH into the server and pull the Docker image | |
| - name: SSH into server and pull Docker image | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USERNAME }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: | | |
| cd ~/wiki | |
| docker compose down --remove-orphans | |
| docker network prune -f | |
| bash run.sh |