From ebb43fee4714357959153a8d8b990fb9bee61a3c Mon Sep 17 00:00:00 2001 From: Amos Date: Sat, 9 Mar 2024 17:58:17 +0800 Subject: [PATCH] Delete: cloud_build --- cloud_build/deploy.yaml | 17 ---------- .../stage_site_and_comment_on_github.sh | 34 ------------------- cloud_build/stage.yaml | 29 ---------------- 3 files changed, 80 deletions(-) delete mode 100644 cloud_build/deploy.yaml delete mode 100644 cloud_build/scripts/stage_site_and_comment_on_github.sh delete mode 100644 cloud_build/stage.yaml diff --git a/cloud_build/deploy.yaml b/cloud_build/deploy.yaml deleted file mode 100644 index dc810b854..000000000 --- a/cloud_build/deploy.yaml +++ /dev/null @@ -1,17 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/git - args: ['submodule', 'update', '--init', '--recursive'] - - name: gcr.io/flutter-dev-230821/firebase-ghcli - # Set up, build, then deploy site to production - entrypoint: '/bin/bash' - args: - - '-c' - - |- - set -e - - npm install - npm run build-site-for-production - - firebase deploy --project=dart-dev --only=hosting -options: - logging: CLOUD_LOGGING_ONLY diff --git a/cloud_build/scripts/stage_site_and_comment_on_github.sh b/cloud_build/scripts/stage_site_and_comment_on_github.sh deleted file mode 100644 index 55be4263d..000000000 --- a/cloud_build/scripts/stage_site_and_comment_on_github.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -e - -deploy_to_firebase_staging_channel () { - echo "Deploying website to a staging channel on firebase..." - - # Deploy to firebase, but save the output to a variable so we can grep the - # url from the output and save it to FIREBASE_STAGING_URL for future use. - FIREBASE_DEPLOY_RESPONSE=$(firebase hosting:channel:deploy --expires 7d pr$PR_NUMBER-$HEAD_BRANCH --project=$PROJECT_ID) - echo "$FIREBASE_DEPLOY_RESPONSE" - FIREBASE_STAGING_URL=$(grep -Eo "https://$PROJECT_ID--[a-zA-Z0-9./?=_%:-]*" <<< "$FIREBASE_DEPLOY_RESPONSE") -} - -login_to_github() { - echo "Logging into github under bot account..." - - echo $GH_PAT_TOKEN > token - gh auth login --with-token < token -} - -comment_staging_url_on_github () { - echo "Commenting staging url on the PR..." - COMMENT_BODY=$(echo -e "Visit the preview URL for this PR (updated for commit $COMMIT_SHA):\n\n$FIREBASE_STAGING_URL") - - # The github CLI throws an error if --edit-last doesn't find a previous - # comment, so this edits the last comment, but if it doesn't exist, - # leave a new comment. - gh pr comment $PR_NUMBER --edit-last --body "$COMMENT_BODY" --repo $REPO_FULL_NAME || \ - gh pr comment $PR_NUMBER --body "$COMMENT_BODY" --repo $REPO_FULL_NAME -} - -deploy_to_firebase_staging_channel -login_to_github -comment_staging_url_on_github diff --git a/cloud_build/stage.yaml b/cloud_build/stage.yaml deleted file mode 100644 index 919f7bfbb..000000000 --- a/cloud_build/stage.yaml +++ /dev/null @@ -1,29 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/git - args: ['submodule', 'update', '--init', '--recursive'] - - name: gcr.io/flutter-dev-230821/firebase-ghcli - # Set up, build, deploy site to staging, then comment link on PR - entrypoint: '/bin/bash' - args: - - '-c' - - |- - set -e - - npm install - npm run build-site-for-staging - - cloud_build/scripts/stage_site_and_comment_on_github.sh - secretEnv: ['GH_PAT_TOKEN'] - env: - - 'PR_NUMBER=$_PR_NUMBER' - - 'HEAD_BRANCH=$_HEAD_BRANCH' - - 'PROJECT_ID=$PROJECT_ID' - - 'COMMIT_SHA=$COMMIT_SHA' - - 'REPO_FULL_NAME=$REPO_FULL_NAME' -availableSecrets: - secretManager: - - versionName: projects/$PROJECT_ID/secrets/dart-github-bot-comment-pat/versions/latest - env: 'GH_PAT_TOKEN' -timeout: 1200s -options: - logging: CLOUD_LOGGING_ONLY