-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Giveth/staging
Fixing the Deployment CI Pipeline
- Loading branch information
Showing
1 changed file
with
29 additions
and
14 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 |
---|---|---|
|
@@ -21,29 +21,44 @@ jobs: | |
tag_with_ref: true | ||
# Add commit hash to docker image tag @see{@link https://github.com/docker/build-push-action/tree/releases/v1#tag_with_sha} | ||
tag_with_sha: true | ||
|
||
deploy: | ||
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/master' | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: production deploy | ||
if: github.ref == 'refs/heads/master' | ||
uses: garygrossgarten/github-action[email protected] | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
# pull images, restart docker, then remove unused docker images | ||
command: cd givback-calculation && git checkout master && git pull origin master && docker-compose -f docker-compose-production.yml pull && docker-compose -f docker-compose-production.yml down && docker-compose -f docker-compose-production.yml up -d && docker image prune -a --force | ||
host: ${{ secrets.DEVELOP_HOST }} | ||
username: ${{ secrets.DEVELOP_USERNAME }} | ||
# passphrase: ${{ secrets.PASSPHRASE }} | ||
privateKey: ${{ secrets.DEVELOP_PRIVATE_KEY}} | ||
host: ${{ secrets.PROD_HOST }} | ||
username: ${{ secrets.PROD_USERNAME }} | ||
key: ${{ secrets.PROD_PRIVATE_KEY }} | ||
port: 22 | ||
script: | | ||
cd $HOME/givback-calculation-production | ||
git checkout master | ||
git checkout -- . | ||
git pull | ||
docker compose -f docker-compose-production.yml pull | ||
docker compose -f docker-compose-production.yml down | ||
docker compose -f docker-compose-production.yml up -d | ||
docker image prune -a --force | ||
- name: staging deploy | ||
if: github.ref == 'refs/heads/staging' | ||
uses: garygrossgarten/github-action[email protected] | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
# pull images, restart docker, then remove unused docker images | ||
command: cd givback-calculation-staging && git checkout staging && git pull origin staging && docker-compose -f docker-compose-staging.yml pull && docker-compose -f docker-compose-staging.yml down && docker-compose -f docker-compose-staging.yml up -d && docker image prune -a --force | ||
host: ${{ secrets.DEVELOP_HOST }} | ||
username: ${{ secrets.DEVELOP_USERNAME }} | ||
# passphrase: ${{ secrets.PASSPHRASE }} | ||
privateKey: ${{ secrets.DEVELOP_PRIVATE_KEY}} | ||
host: ${{ secrets.STAGING_HOST }} | ||
username: ${{ secrets.STAGING_USERNAME }} | ||
key: ${{ secrets.STAGING_PRIVATE_KEY }} | ||
port: 22 | ||
script: | | ||
cd $HOME/givback-calculation-staging | ||
git checkout staging | ||
git checkout -- . | ||
git pull | ||
docker compose -f docker-compose-staging.yml pull | ||
docker compose -f docker-compose-staging.yml down | ||
docker compose -f docker-compose-staging.yml up -d | ||
docker image prune -a --force |