Adding the main and staging pipelines to work on PR merges #1
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-staging | ||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- staging | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/giveth/giveconomy-notification-service:staging | ||
deploy: | ||
if: github.event.pull_request.merged == true | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Staging deploy | ||
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}} |