Skip to content

Commit

Permalink
Merge pull request #76 from gitcoinco/2683-id-staking-workflow
Browse files Browse the repository at this point in the history
feat: deployment workflow
  • Loading branch information
tim-schultz authored Jul 19, 2024
2 parents 0247375 + 64d1b9f commit 23271da
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/release_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Release and Deploy
on:
workflow_dispatch:
inputs:
commit:
description: "Leave blank to use current HEAD, or provide an override commit SHA"
type: string
required: false

jobs:
ref:
name: Load Commit Ref
runs-on: ubuntu-latest
steps:
- id: ref
uses: passportxyz/gh-workflows/.github/actions/load_commit_ref@main
with:
commit: ${{ inputs.commit }}
outputs:
version_tag: ${{ steps.ref.outputs.version_tag }}
docker_tag: ${{ steps.ref.outputs.docker_tag }}
refspec: ${{ steps.ref.outputs.refspec }}

push_to_staging:
name: Push to Staging
needs: ref
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Push to Staging Branch
uses: passportxyz/gh-workflows/.github/actions/push-to-branch@main
with:
commit: ${{ needs.ref.outputs.refspec }}
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: "staging-app"

outputs:
deployed-commit: ${{ steps.push-to-branch.outputs.deployed-commit }}

wait_for_production_approval:
name: Production Approval Pending
needs: [ref, push_to_staging]
runs-on: ubuntu-latest
environment: production
steps:
- name: Approve Release to Production
run: |
echo "Approved Production Release for: " ${{ needs.ref.outputs.version_tag }}
echo "Ref: ${{ needs.ref.outputs.refspec }}"
push_to_production:
name: Push to Production
needs: [ref, wait_for_production_approval]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Push to Production Branch
uses: passportxyz/gh-workflows/.github/actions/push-to-branch@main
with:
commit: ${{ needs.ref.outputs.refspec }}
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: "production-app"

outputs:
deployed-commit: ${{ steps.push-to-branch.outputs.deployed-commit }}

deployment_info:
name: Display Deployment Information
needs: [ref, push_to_staging, push_to_production]
runs-on: ubuntu-latest
steps:
- name: Show Deployment Details
run: |
echo "Version Tag: ${{ needs.ref.outputs.version_tag }}"
echo "Docker Tag: ${{ needs.ref.outputs.docker_tag }}

0 comments on commit 23271da

Please sign in to comment.