-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: CD pipeline * feat: all container services should live till docker service lives * feat: trigger based on paths relevant for deployment * feat: added sync file
- Loading branch information
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Continuous Deployment for Metakgp-Wiki | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
paths: | ||
- "jobs/**" | ||
- "mediawiki/**" | ||
- "mysql/**" | ||
- "nginx/**" | ||
- "docker-compose.prod.yml" | ||
- "docker-compose.yml" | ||
|
||
jobs: | ||
pull: | ||
name: Pull Stage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Sync with remote repository | ||
uses: appleboy/ssh-action@master | ||
env: | ||
WIKI_DIR: ${{ secrets.WIKI_DIR }} | ||
with: | ||
host: ${{ secrets.HOSTNAME }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
envs: WIKI_DIR | ||
script_stop: true | ||
script: | | ||
cd "${WIKI_DIR}/" | ||
sudo git fetch origin | ||
sudo git reset --hard origin/master | ||
build: | ||
name: Build Stage | ||
needs: pull | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Build the latest docker container | ||
uses: appleboy/ssh-action@master | ||
env: | ||
WIKI_DIR: ${{ secrets.WIKI_DIR }} | ||
with: | ||
host: ${{ secrets.HOSTNAME }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
envs: WIKI_DIR | ||
script_stop: true | ||
script: | | ||
cd "${WIKI_DIR}/" | ||
sudo docker compose -f docker-compose.prod.yml build | ||
deploy: | ||
name: Deploy Stage | ||
needs: [pull, build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy the latest build | ||
uses: appleboy/ssh-action@master | ||
env: | ||
WIKI_DIR: ${{ secrets.WIKI_DIR }} | ||
with: | ||
host: ${{ secrets.HOSTNAME }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
envs: WIKI_DIR | ||
script_stop: true | ||
script: | | ||
cd "${WIKI_DIR}/" | ||
sudo docker compose -f docker-compose.prod.yml down | ||
sudo docker compose -f docker-compose.prod.yml up -d |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Sync Important Items Except Those Needed For Deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
paths: | ||
- "scripts/**" | ||
|
||
jobs: | ||
pull: | ||
name: Pull Stage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Sync with remote repository | ||
uses: appleboy/ssh-action@master | ||
env: | ||
WIKI_DIR: ${{ secrets.WIKI_DIR }} | ||
with: | ||
host: ${{ secrets.HOSTNAME }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
envs: WIKI_DIR | ||
script_stop: true | ||
script: | | ||
cd "${WIKI_DIR}/" | ||
sudo git fetch origin | ||
sudo git reset --hard origin/master |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ include: | |
services: | ||
jobs: | ||
build: "./jobs" | ||
restart: always | ||
networks: | ||
mysql-network: | ||
environment: | ||
|
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