Fix gradle scan link (#1408) #2426
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: Terraform | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
monitor_permissions: | |
type: boolean | |
description: Monitor Permissions | |
required: false | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Google Cloud | |
runs-on: ubuntu-latest | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.logging.level=${{ github.event.inputs.log_level || 'info' }}" | |
permissions: | |
pull-requests: 'write' | |
id-token: write | |
steps: | |
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
if: ${{ github.event.inputs.monitor_permissions == 'true' }} | |
- uses: actions/checkout@v4 | |
- id: setup-cloud | |
uses: ./.github/actions/setup-cloud | |
with: | |
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY }} | |
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ID }} | |
token_format: access_token | |
- uses: ./.github/actions/setup-gradle | |
if: ${{ github.ref == 'refs/heads/main' }} | |
- if: ${{ github.ref == 'refs/heads/main' }} | |
run: > | |
./gradlew cloud-run:jib | |
--image=europe-west1-docker.pkg.dev/${{ steps.setup-cloud.outputs.project_id }}/cloud-run-source-deploy/api.ashdavies.dev | |
--no-configuration-cache | |
--console=plain | |
# env: | |
# FIREBASE_ANDROID_APP_ID: ${{ secrets.firebase_android_app_id }} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# GOOGLE_SERVICE_ACCOUNT_ID: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ID }} | |
- id: token | |
uses: tibdex/github-app-token@v2 | |
with: | |
private_key: ${{ secrets.PRIVATE_KEY }} | |
app_id: ${{ secrets.APP_ID }} | |
- uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: 1.10.3 | |
- id: init | |
run: terraform -chdir=terraform init | |
- id: plan | |
env: | |
TF_VAR_gh_token: ${{ steps.token.outputs.token }} | |
TF_LOG: ${{ inputs.debug && 'DEBUG' || 'ERROR' }} | |
TF_INPUT: false | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
terraform -chdir=terraform plan >/dev/null -lock-timeout=5m -out=.terraform/terraform.tfplan | |
terraform -chdir=terraform show .terraform/terraform.tfplan -no-color | |
- uses: thollander/actions-comment-pull-request@v3 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
message: "```${{ steps.plan.outputs.stdout }}```" | |
comment-tag: terraform-plan | |
mode: recreate | |
- id: apply | |
env: | |
TF_LOG: ${{ inputs.debug && 'DEBUG' || 'ERROR' }} | |
TF_VAR_gh_token: ${{ steps.token.outputs.token }} | |
TF_INPUT: false | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: terraform -chdir=terraform apply -auto-approve -lock-timeout=5m |