[SYNC] master => develop #27
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 }} | |
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 | |
secrets: inherit | |
run: | |
name: Run | |
if: github.event.issue.pull_request && contains(github.event.comment.body, '/deploy') | |
runs-on: | |
- metal | |
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 | |
- 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/[email protected] | |
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 |