diff --git a/.github/workflows/CI-CD.yml b/.github/workflows/CI-CD.yml deleted file mode 100644 index cc37dd0..0000000 --- a/.github/workflows/CI-CD.yml +++ /dev/null @@ -1,56 +0,0 @@ -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/github-action-ssh@v0.6.4 - 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/github-action-ssh@v0.6.4 - 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/github-action-ssh@v0.6.4 - 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}} diff --git a/.github/workflows/main-pipeline.yml b/.github/workflows/main-pipeline.yml new file mode 100644 index 0000000..4b9c898 --- /dev/null +++ b/.github/workflows/main-pipeline.yml @@ -0,0 +1,50 @@ +name: ci-main + +on: + pull_request: + types: [closed] + branches: + - main + workflow_dispatch: + +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:main + + deploy: + if: github.event.pull_request.merged == true + needs: publish + runs-on: ubuntu-latest + steps: + - name: SSH and Redeploy + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.PROD_HOST_ALL }} + username: ${{ secrets.PROD_USERNAME_ALL }} + key: ${{ secrets.PROD_PRIVATE_KEY_ALL }} + port: ${{ secrets.SSH_PORT }} + script: | + cd giveth-all + docker-compose stop givEconomy-notification-service + docker-compose pull givEconomy-notification-service + docker-compose up -d givEconomy-notification-service + docker image prune -a --force diff --git a/.github/workflows/staging-pipeline.yml b/.github/workflows/staging-pipeline.yml new file mode 100644 index 0000000..4813157 --- /dev/null +++ b/.github/workflows/staging-pipeline.yml @@ -0,0 +1,49 @@ +name: ci-staging + +on: + pull_request: + types: [closed] + branches: + - staging + workflow_dispatch: + +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: + needs: publish + runs-on: ubuntu-latest + steps: + - name: SSH and Redeploy + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.STAGING_HOST_ALL }} + username: ${{ secrets.STAGING_USERNAME_ALL }} + key: ${{ secrets.STAGING_PRIVATE_KEY_ALL }} + port: ${{ secrets.SSH_PORT }} + script: | + cd giveth-all + docker-compose stop givEconomy-notification-service + docker-compose pull givEconomy-notification-service + docker-compose up -d givEconomy-notification-service + docker image prune -a --force diff --git a/monitorConfig/production.ts b/monitorConfig/production.ts index 24e7831..73d717d 100644 --- a/monitorConfig/production.ts +++ b/monitorConfig/production.ts @@ -36,6 +36,12 @@ export const config: Config = { pollTimeMS: Number(process.env.OPTIMISM_POLL_TIME) || 30_000, // 30 Seconds maxFetchBlockRange: 1_000, contracts: [ + { + address: '0x301C739CF6bfb6B47A74878BdEB13f92F13Ae5E7', + title: 'Optimism GIVPower', + startBlock: 108350094, + type: ContractType.GIVpower, + }, { address: '0xE3Ac7b3e6B4065f4765d76fDC215606483BF3bD1', title: 'Optimism Token Distro',