OCT-2176 Make the added projects badge red #395
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: ♻ PR Deployment | |
on: | |
issue_comment: | |
types: [ created ] | |
jobs: | |
build: | |
name: Build | |
needs: | |
- run | |
uses: ./.github/workflows/tpl-images.yml | |
secrets: inherit | |
with: | |
image-tag: ${{ needs.run.outputs.sha }} | |
git-ref: ${{ needs.run.outputs.ref }} | |
deploy: | |
name: Deploy | |
needs: | |
- run | |
- build | |
uses: ./.github/workflows/tpl-deploy-app.yml | |
with: | |
# --- | |
env-type: pr | |
branch-head-ref: ${{ needs.run.outputs.ref }} | |
image-tag: ${{ needs.run.outputs.sha }} | |
pull-request-id: ${{ needs.run.outputs.pr_id }} | |
workflow-id: ${{ github.run_id }} | |
env-id: ${{ needs.run.outputs.env }} | |
deployment-id: ${{ needs.run.outputs.deployment }} | |
# --- | |
deploy-contracts: true | |
chain-id: 1337 | |
network-name: local | |
chain-name: localhost | |
snapshotter-enabled: true | |
scheduler-enabled: true | |
vault-confirm-withdrawals-enabled: true | |
glm-claim-enabled: true | |
anvil-block-time: 5 | |
decision-window: 1800 | |
epoch-duration: 3600 | |
ipfs-gateways: 'https://ipfs.octant.wildland.dev/ipfs/' | |
secrets: inherit | |
run: | |
name: Run | |
if: github.event.issue.pull_request && contains(github.event.comment.body, '/deploy') | |
runs-on: | |
- general | |
outputs: | |
sha: ${{ steps.comment-branch.outputs.head_sha }} | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
pr_id: ${{ steps.get-pr-number.outputs.result }} | |
env: ${{ steps.start-deployment.outputs.env }} | |
deployment: ${{ steps.start-deployment.outputs.deployment_id }} | |
steps: | |
- name: Get PR branch | |
uses: xt0rted/pull-request-comment-branch@v2 | |
id: comment-branch | |
- name: Check if user is an org member | |
uses: actions/github-script@v7 | |
id: is-organization-member | |
with: | |
result-encoding: string | |
github-token: ${{ secrets.GH_BOT_TOKEN }} | |
script: | | |
return ( | |
await github.rest.orgs.listMembers({ | |
org: 'golemfoundation' | |
}) | |
).data.map(({login}) => login).includes('${{ github.event.comment.user.login }}').toString() | |
- name: Cancel workflow | |
if: ${{ steps.is-organization-member.outputs.result == 'false' }} | |
run: | | |
echo '${{ github.event.comment.user.login }} is not a member of the golemfoundation org' | |
exit 1 | |
- uses: actions/github-script@v7 | |
id: get-pr-number | |
with: | |
result-encoding: string | |
script: | | |
return ( | |
await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
commit_sha: '${{ steps.comment-branch.outputs.head_sha }}', | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
).data[0].number; | |
- uses: actions/checkout@v4.1.0 | |
with: | |
path: __local | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
- name: Get environment name | |
id: env-name | |
env: | |
CI_MERGE_REQUEST_IID: ${{ steps.get-pr-number.outputs.result }} | |
CI_PIPELINE_ID: ${{ github.run_id }} | |
run: | | |
set -ex | |
export CI_PROJECT_DIR="${GITHUB_WORKSPACE}/__local" | |
source ${CI_PROJECT_DIR}/ci/argocd/resolve_env.sh $ENV_TYPE | |
echo "DEPLOYMENT_ID=$DEPLOYMENT_ID" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: (debug) | |
run: | | |
echo ${{ steps.get-pr-number.outputs.result }} | |
echo ${{ steps.env-name.outputs.DEPLOYMENT_ID }} | |
echo ${{ github.run_id }} | |
- name: start deployment | |
uses: bobheadxi/deployments@v1 | |
id: start-deployment | |
with: | |
step: start | |
token: ${{ secrets.GH_BOT_TOKEN }} | |
env: ${{ steps.env-name.outputs.DEPLOYMENT_ID }} | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
override: true |