Added production optimism givpower #49
Workflow file for this run
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
name: CI/CD | |
on: [push] | |
jobs: | |
publish: | |
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Build image and push to GitHub Packages | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
registry: ghcr.io | |
repository: giveth/giveconomy-notification-service | |
add_git_labels: true | |
# Add branch name to docker image tag @see{@link https://github.com/docker/build-push-action/tree/releases/v1#tag_with_ref} | |
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/develop' || github.ref == 'refs/heads/main'|| github.ref == 'refs/heads/staging' | |
needs: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Staging deploy | |
if: github.ref == 'refs/heads/staging' | |
uses: garygrossgarten/[email protected] | |
with: | |
command: cd giveconomy-notification-service && git checkout staging && 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; | |
host: ${{ secrets.STAGING_HOST }} | |
username: ${{ secrets.STAGING_USERNAME }} | |
privateKey: ${{ secrets.STAGING_PRIVATE_KEY}} | |
- name: Develop deploy | |
if: github.ref == 'refs/heads/develop' | |
uses: garygrossgarten/[email protected] | |
with: | |
command: cd giveconomy-notification-service && git checkout develop && git pull && docker-compose -f docker-compose-develop.yml pull && docker-compose -f docker-compose-develop.yml down && docker-compose -f docker-compose-develop.yml up -d && docker image prune -a --force; | |
host: ${{ secrets.DEVELOP_HOST }} | |
username: ${{ secrets.DEVELOP_USERNAME }} | |
privateKey: ${{ secrets.DEVELOP_PRIVATE_KEY}} | |
- name: Production deploy | |
if: github.ref == 'refs/heads/main' | |
uses: garygrossgarten/[email protected] | |
with: | |
command: cd giveconomy-notification-service && git checkout main && 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; | |
host: ${{ secrets.PRODUCTION_HOST }} | |
username: ${{ secrets.PRODUCTION_USERNAME }} | |
privateKey: ${{ secrets.PRODUCTION_PRIVATE_KEY}} |