Skip to content

feat: expose on .org #90

feat: expose on .org

feat: expose on .org #90

Workflow file for this run

name: ci_terraform
on:
push:
branches:
- main
paths:
- "terraform/**"
pull_request:
paths:
- "terraform/**"
concurrency:
# Support push/pr as event types with different behaviors each:
# 1. push: queue up builds
# 2. pr: only allow one run per PR
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }}
# If there is already a workflow running for the same pull request, cancel it
cancel-in-progress: ${{ github.event.type == 'PullRequest' }}
env:
TF_VAR_project_registry_auth_token: ${{ secrets.PROJECT_REGISTRY_AUTH_TOKEN }}
TF_VAR_secret: ${{ secrets.SECRET }}
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: fmt
uses: WalletConnect/actions/actions/fmt-check-terraform/@master
plan:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
environment:
name: infra/staging
url: https://staging.verify.walletconnect.com/health
steps:
- name: Checkout
uses: actions/checkout@v3
# Get latest release for image version
- id: latest_release
uses: pozetroninc/github-action-get-latest-release@master
if: github.event_name != 'release'
with:
repository: ${{ github.repository }}
excludes: draft
- name: Run Terraform Plan
id: plan
uses: WalletConnect/actions/actions/plan-terraform/@master
env:
TF_VAR_image_version: ${{ steps.latest_release.outputs.release }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
environment: staging
app-name: ${{ github.event.repository.name }}
- uses: actions/upload-artifact@v3
with:
name: plan.tfplan
path: ${{ steps.plan.outputs.plan-file }}
- uses: actions/upload-artifact@v3
with:
name: plan.txt
path: ${{ steps.plan.outputs.output-file }}
- name: Add Plan to PR
uses: actions/github-script@v6
env:
PLAN: "terraform\n${{ steps.plan.outputs.plan }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*Action: \`${{ github.event_name }}\`*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})