diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 600ace2..16b73ba 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -5,76 +5,76 @@ on: branches: - "master" paths: - - ".github/workflows/deploy.yaml" - "jobs/**" - "mediawiki/**" - "mysql/**" - "nginx/**" - "docker-compose.prod.yml" - "docker-compose.yml" + - ".github/workflows/deploy.yaml" jobs: - pull: - name: Pull Stage + push: + name: Push Stage runs-on: ubuntu-latest steps: - - name: Sync with remote repository + - name: Sync local repo with remote repo uses: appleboy/ssh-action@master env: - WIKI_DIR: ${{ secrets.WIKI_DIR }} + PROJECT_DIR: ${{ secrets.PROJECT_DIR }} with: - host: ${{ secrets.HOSTNAME }} - username: ${{ secrets.USERNAME }} + host: ${{ secrets.SSH_HOSTNAME }} + username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} - envs: WIKI_DIR + passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }} + envs: PROJECT_DIR script_stop: true script: | - cd "${WIKI_DIR}/" + cd "${PROJECT_DIR}/" sudo git fetch origin sudo git reset --hard origin/master build: name: Build Stage - needs: pull + needs: push runs-on: ubuntu-latest steps: - - name: Build the latest docker container + - name: Build the latest container(s) uses: appleboy/ssh-action@master env: - WIKI_DIR: ${{ secrets.WIKI_DIR }} + PROJECT_DIR: ${{ secrets.PROJECT_DIR }} with: - host: ${{ secrets.HOSTNAME }} - username: ${{ secrets.USERNAME }} + host: ${{ secrets.SSH_HOSTNAME }} + username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} + passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }} command_timeout: 60m - envs: WIKI_DIR + envs: PROJECT_DIR script_stop: true script: | - cd "${WIKI_DIR}/" + cd "${PROJECT_DIR}/" sudo docker compose -f docker-compose.prod.yml build deploy: name: Deploy Stage - needs: [pull, build] + needs: [push, build] runs-on: ubuntu-latest steps: - - name: Deploy the latest build + - name: Deploy the latest build(s) uses: appleboy/ssh-action@master env: - WIKI_DIR: ${{ secrets.WIKI_DIR }} + PROJECT_DIR: ${{ secrets.PROJECT_DIR }} with: - host: ${{ secrets.HOSTNAME }} - username: ${{ secrets.USERNAME }} + host: ${{ secrets.SSH_HOSTNAME }} + username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} - envs: WIKI_DIR + passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }} + envs: PROJECT_DIR script_stop: true script: | - cd "${WIKI_DIR}/" + cd "${PROJECT_DIR}/" sudo docker compose -f docker-compose.prod.yml down sudo docker compose -f docker-compose.prod.yml up -d diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 0450342..1b62266 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -5,27 +5,27 @@ on: branches: - "master" paths: - - ".github/workflows/sync.yaml" - "scripts/**" + - ".github/workflows/sync.yaml" jobs: - pull: - name: Pull Stage + push: + name: Push Stage runs-on: ubuntu-latest steps: - - name: Sync with remote repository + - name: Sync local repo with remote repo uses: appleboy/ssh-action@master env: - WIKI_DIR: ${{ secrets.WIKI_DIR }} + PROJECT_DIR: ${{ secrets.PROJECT_DIR }} with: - host: ${{ secrets.HOSTNAME }} - username: ${{ secrets.USERNAME }} + host: ${{ secrets.SSH_HOSTNAME }} + username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} - passphrase: ${{ secrets.PASSPHRASE }} - envs: WIKI_DIR + passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }} + envs: PROJECT_DIR script_stop: true script: | - cd "${WIKI_DIR}/" + cd "${PROJECT_DIR}/" sudo git fetch origin sudo git reset --hard origin/master \ No newline at end of file