From e1ec2b24f0f73186f4f479d574fa33a164bac442 Mon Sep 17 00:00:00 2001 From: carly Date: Thu, 20 Nov 2025 11:54:28 -0500 Subject: [PATCH 1/7] format --- terraform/monthly_submissions/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/monthly_submissions/main.tf b/terraform/monthly_submissions/main.tf index 066ac3c3..ce945054 100644 --- a/terraform/monthly_submissions/main.tf +++ b/terraform/monthly_submissions/main.tf @@ -57,7 +57,7 @@ resource "google_project_iam_member" "cloudsql_client" { resource "google_cloudfunctions2_function" "function" { name = "stats-monthly-submissions" # name should use kebab-case so generated Cloud Run service name will be the same - location = var.gcp_region # needs to be explicitly declared for Cloud Run + location = var.gcp_region # needs to be explicitly declared for Cloud Run description = "Cloud function to sum submissions and persist to a database" build_config { From 285ed3250734fb9f04aca98db5b60c04c43605cb Mon Sep 17 00:00:00 2001 From: carly Date: Wed, 3 Dec 2025 11:52:26 -0500 Subject: [PATCH 2/7] update workflows --- .github/workflows/build-push-api.yml | 71 ++++++++++++ .github/workflows/build-stats-api.yml | 101 ---------------- .github/workflows/deploy-function.yml | 4 +- .github/workflows/deploy-stats-api.yml | 139 ----------------------- .github/workflows/deploy.yml | 70 ++++++++++++ .github/workflows/lint-and-test-api.yml | 18 ++- .github/workflows/stats-api-triggers.yml | 60 ++++++++++ 7 files changed, 215 insertions(+), 248 deletions(-) create mode 100644 .github/workflows/build-push-api.yml delete mode 100644 .github/workflows/build-stats-api.yml delete mode 100644 .github/workflows/deploy-stats-api.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/stats-api-triggers.yml diff --git a/.github/workflows/build-push-api.yml b/.github/workflows/build-push-api.yml new file mode 100644 index 00000000..f6240daa --- /dev/null +++ b/.github/workflows/build-push-api.yml @@ -0,0 +1,71 @@ +name: Build and push + +on: + workflow_call: + inputs: + commit_sha: + description: Commit SHA to deploy (leave blank for latest) + required: false + type: string + dockerfile: + description: Path to Dockerfile + required: false + type: string + image_name: + description: Name to be given to created image + required: false + type: string + port: + description: Container port + required: false + type: string + target: + description: Multistage build target + required: false + type: string + +permissions: + id-token: write + +env: + GCP_PROJECT_ID: arxiv-development + +jobs: + build-push: + runs-on: ubuntu-latest + environment: development + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit_sha || github.sha }} + + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v3 + with: + workload_identity_provider: ${{ vars.PROVIDER_NAME }} + service_account: ${{ vars.SERVICE_ACCOUNT }} + + - name: Set up Google Cloud SDK + uses: google-github-actions/setup-gcloud@v3 + + - name: Configure Docker + run: gcloud auth configure-docker + + - name: Build image, caching from latest + run: | + docker pull gcr.io/${{ env.GCP_PROJECT_ID }}/${{ inputs.image_name }}:latest + + BRANCH_TAG="$(printf "%.128s" "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" | sed 's/^[.-]*//')" + + docker build --target ${{ inputs.target }} --build-arg PORT=${{ inputs.port }} -f ${{ inputs.dockerfile }} \ + --cache-from gcr.io/${{ env.GCP_PROJECT_ID }}/${{ inputs.image_name }}:latest \ + -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ inputs.image_name }}:${{ inputs.commit_sha || github.sha }} \ + -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ inputs.image_name }}:${BRANCH_TAG} \ + ${{ github.ref_name == 'main' && format('-t gcr.io/{0}/{1}:latest', env.GCP_PROJECT_ID, inputs.image_name) || '' }} . + + - name: Push image + # only push if merged to main + if: github.ref == "refs/heads/main" + run: docker push --all-tags gcr.io/${{ env.GCP_PROJECT_ID }}/${{ inputs.image_name }} diff --git a/.github/workflows/build-stats-api.yml b/.github/workflows/build-stats-api.yml deleted file mode 100644 index 4b97c7fe..00000000 --- a/.github/workflows/build-stats-api.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Build and push stats-api - -run-name: "Build stats-api ${{ github.ref_name }} ${{ inputs.custom_sha || github.sha }}" - -on: - push: - branches: - - main - paths: - - "stats-api/**" - pull_request: - branches: - - main - paths: - - "stats-api/**" - workflow_dispatch: - inputs: - custom_sha: - description: 'Custom SHA (image rebuilds only)' - required: false - type: string - -permissions: - id-token: write - actions: write - -env: - DEPLOY_WORKFLOW: "deploy-stats-api.yml" - DOCKERFILE: "Dockerfile.api" - GCP_PROJECT_ID: "arxiv-development" - IMAGE_NAME: "stats-api" - PORT: "8080" - TARGET: "runtime" - -jobs: - format-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up terraform - uses: hashicorp/setup-terraform@v3 - - - name: Check version - run: terraform --version - - - name: Format check - run: terraform fmt -check - - build-push: - needs: format-check - runs-on: ubuntu-latest - - concurrency: - group: build-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ inputs.custom_sha || github.sha }} - - - name: Authenticate to Google Cloud - uses: google-github-actions/auth@v3 - with: - workload_identity_provider: ${{ vars.ARXIV_DEVELOPMENT_PROVIDER_NAME }} - service_account: ${{ vars.ARXIV_DEVELOPMENT_SERVICE_ACCOUNT }} - - - name: Set up Google Cloud SDK - uses: google-github-actions/setup-gcloud@v3 - - - name: Configure Docker - run: gcloud auth configure-docker - - - name: Build image, caching from latest - run: | - docker pull gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:latest - - BRANCH_TAG="$(printf "%.128s" "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" | sed 's/^[.-]*//')" - - docker build --target ${TARGET} --build-arg PORT=${PORT} -f ${DOCKERFILE} \ - --cache-from gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:latest \ - -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ inputs.custom_sha || github.sha }} \ - -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${BRANCH_TAG} \ - ${{ github.ref_name == 'main' && format('-t gcr.io/{0}/{1}:latest', env.GCP_PROJECT_ID, env.IMAGE_NAME) || '' }} . - - - name: Push image - run: docker push --all-tags gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME} - - # CI Deployment Routing ... manual builds of a commit are not CD candidates - - name: Deployment Routing - if: ${{ !inputs.custom_sha }} - uses: arXiv/iac-public/.github/actions/service-deployment-routing@main - with: - image_tag: ${{ github.sha }} - deploy_workflow: ${{ env.DEPLOY_WORKFLOW }} - workload_identity_provider: ${{ vars.ARXIV_DEVELOPMENT_PROVIDER_NAME }} - service_account: ${{ vars.ARXIV_DEVELOPMENT_SERVICE_ACCOUNT }} \ No newline at end of file diff --git a/.github/workflows/deploy-function.yml b/.github/workflows/deploy-function.yml index 01097ad7..64833d50 100644 --- a/.github/workflows/deploy-function.yml +++ b/.github/workflows/deploy-function.yml @@ -8,7 +8,7 @@ on: description: Name of the function directory (e.g. aggregate_hourly_downloads) required: true commit_sha: - description: "Commit SHA to deploy (leave blank for latest)" + description: Commit SHA to deploy (leave blank for latest) required: false type: string workflow_dispatch: @@ -18,7 +18,7 @@ on: description: Name of the function directory (e.g. aggregate_hourly_downloads) required: true commit_sha: - description: "Commit SHA to deploy (leave blank for latest)" + description: Commit SHA to deploy (leave blank for latest) required: false type: string environment: diff --git a/.github/workflows/deploy-stats-api.yml b/.github/workflows/deploy-stats-api.yml deleted file mode 100644 index d78ca611..00000000 --- a/.github/workflows/deploy-stats-api.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: Deploy stats-api - -# Set custom run name to show project name in workflow runs list -run-name: "Deploy stats-api ${{ inputs.env }} ${{ inputs.image_tag }}" - -on: - workflow_dispatch: - inputs: - env: - description: "Environment" - required: true - type: string - default: "" - image_tag: - description: "Docker image tag (latest or the commit SHA)" - required: false - type: string - default: "latest" - -permissions: - contents: read - pull-requests: write - id-token: write - -env: - DOCKERFILE: "Dockerfile.api" - IMAGE_NAME: "stats-api" - PORT: "8080" - TARGET: "runtime" - -jobs: - format-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up terraform - uses: hashicorp/setup-terraform@v3 - - - name: Check version - run: terraform --version - - - name: Format check - run: terraform fmt -check - - deploy: - runs-on: ubuntu-latest - needs: format-check - environment: ${{ inputs.env }} - if: > - (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch') && - ((inputs.env != 'production' && inputs.env != 'prod' && inputs.env != 'staging' && inputs.env != 'stage') || inputs.image_tag != 'latest') - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set environment variables - run: | - # Determine environment from inputs or GitHub environment - if [ -n "${{ inputs.env }}" ]; then - ENV_NAME="${{ inputs.env }}" - else - echo "Error: No environment specified" - exit 1 - fi - - REGION="${{ vars.GCP_REGION || 'us-central1' }}" - echo "ENVIRONMENT=$ENV_NAME" >> $GITHUB_ENV - echo "REGION=$REGION" >> $GITHUB_ENV - - # Set project name and terraform bucket based on environment - if [ "$ENV_NAME" = "production" ] || [ "$ENV_NAME" = "prod" ]; then - echo "PROJECT_NAME=arxiv-production" >> $GITHUB_ENV - echo "TERRAFORM_BUCKET=prod-arxiv-terraform-state" >> $GITHUB_ENV - TERRAFORM_ARGS="-var-file=envs/prod.tfvars" - elif [ "$ENV_NAME" = "staging" ] || [ "$ENV_NAME" = "stage" ]; then - echo "PROJECT_NAME=arxiv-stage" >> $GITHUB_ENV - echo "TERRAFORM_BUCKET=stage-arxiv-terraform-state" >> $GITHUB_ENV - TERRAFORM_ARGS="-var-file=envs/staging.tfvars" - elif [ "$ENV_NAME" = "development" ] || [ "$ENV_NAME" = "develop" ] || [ "$ENV_NAME" = "dev" ]; then - echo "PROJECT_NAME=arxiv-development" >> $GITHUB_ENV - echo "TERRAFORM_BUCKET=dev-arxiv-terraform-state" >> $GITHUB_ENV - TERRAFORM_ARGS="-var-file=envs/dev.tfvars" - else - # For custom environments, use the environment name as project name - echo "PROJECT_NAME=$ENV_NAME" >> $GITHUB_ENV - echo "TERRAFORM_BUCKET=$ENV_NAME-arxiv-terraform-state" >> $GITHUB_ENV - TERRAFORM_ARGS="-var-file=envs/dev.tfvars \ - -var=\"gcp_project_id=$ENV_NAME\" \ - -var=\"gcp_region=$REGION\"" - fi - - # Add image_path to TERRAFORM_ARGS for all environments - TERRAFORM_ARGS="$TERRAFORM_ARGS \ - -var=\"image_path=gcr.io/arxiv-development/${{env.IMAGE_NAME}}:${{inputs.image_tag}}\"" - - echo "TERRAFORM_ARGS=$TERRAFORM_ARGS" >> $GITHUB_ENV - - - name: Authenticate with arxiv-development - uses: google-github-actions/auth@v3 - with: - workload_identity_provider: ${{ vars.ARXIV_DEVELOPMENT_PROVIDER_NAME }} - service_account: ${{ vars.ARXIV_DEVELOPMENT_SERVICE_ACCOUNT }} - - - name: Set up Google Cloud SDK - uses: google-github-actions/setup-gcloud@v3 - - - name: Get project number - run: | - echo "Getting project number for project: ${{ env.PROJECT_NAME }}" - PROJECT_NUMBER=$(gcloud projects describe ${{ env.PROJECT_NAME }} --format="value(projectNumber)") - echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> $GITHUB_ENV - echo "Project number: $PROJECT_NUMBER" - - - name: Authenticate with target project workload identity - uses: google-github-actions/auth@v3 - with: - workload_identity_provider: projects/${{ env.PROJECT_NUMBER }}/locations/global/workloadIdentityPools/github/providers/github-actions-provider - service_account: github-actions-sa@${{ env.PROJECT_NAME }}.iam.gserviceaccount.com - project_id: ${{ env.PROJECT_NAME }} - - - name: Set up terraform - uses: hashicorp/setup-terraform@v3 - - - name: Check version - run: terraform --version - - - name: Initialize remote backend - run: terraform init -backend-config="bucket=${{ env.TERRAFORM_BUCKET }}" - working-directory: terraform/stats_api - - - name: Apply - run: | - echo "Running terraform apply..." - terraform apply ${{ env.TERRAFORM_ARGS }} \ - -auto-approve - working-directory: terraform/stats_api \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..de8594fe --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,70 @@ +name: Deploy + +on: + workflow_call: + inputs: + service_name: + type: string + description: Name of the service directory (e.g. stats_api) + required: true + commit_sha: + description: Commit SHA to deploy (leave blank for latest) + required: false + type: string + workflow_dispatch: + inputs: + service_name: + type: string + description: Name of the service directory (e.g. stats_api) + required: true + commit_sha: + description: Commit SHA to deploy (leave blank for latest) + required: false + type: string + environment: + type: environment + description: Select the environment + +env: + IMAGE_URI: gcr.io/arxiv-development/${{ env.IMAGE_NAME }}:${{ inputs.commit_sha || github.sha }} + +permissions: + contents: read + id-token: write + +jobs: + deploy: + runs-on: ubuntu-latest + environment: ${{ inputs.environment || "development" }} + if: github.ref == "refs/heads/main" + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v3 + with: + workload_identity_provider: ${{ vars.PROVIDER_NAME }} + service_account: ${{ vars.SERVICE_ACCOUNT }} + + - name: Set up Google Cloud SDK + uses: google-github-actions/setup-gcloud@v3 + + - name: Set up terraform + uses: hashicorp/setup-terraform@v3 + + - name: Check version + run: terraform --version + + - name: Initialize remote backend + run: terraform init -backend-config="bucket=${{ vars.ENV_VAR }}-arxiv-terraform-state" + working-directory: "terraform/${{ inputs.service_name }}" + + - name: Format check + run: terraform fmt -check + working-directory: "terraform/${{ inputs.service_name }}" + + - name: Apply + run: terraform apply -var-file=envs/${{ vars.ENV_VAR }}.tfvars -var="image_path=${{ env.IMAGE_PATH }}" -auto-approve + working-directory: "terraform/${{ inputs.service_name }}" diff --git a/.github/workflows/lint-and-test-api.yml b/.github/workflows/lint-and-test-api.yml index 8fdcabb3..dbf7273a 100644 --- a/.github/workflows/lint-and-test-api.yml +++ b/.github/workflows/lint-and-test-api.yml @@ -1,12 +1,18 @@ -name: Lint and test stats-api +name: Lint and test Python services on: - pull_request: - branches: - - main - paths: - - "stats-api/**" + workflow_call: + inputs: + service_name: + type: string + description: The name of the service directory (e.g. stats_api) + required: true workflow_dispatch: + inputs: + service_name: + type: string + description: Name of the service directory (e.g. stats_api) + required: true permissions: contents: read diff --git a/.github/workflows/stats-api-triggers.yml b/.github/workflows/stats-api-triggers.yml new file mode 100644 index 00000000..602b41b2 --- /dev/null +++ b/.github/workflows/stats-api-triggers.yml @@ -0,0 +1,60 @@ +name: Stats API triggers + +on: + push: + branches: + - main + paths: + - "stats-api/stats_api/**" + - "terraform/stats_api/**" + - ".github/workflows/deploy.yml" + - ".github/workflows/build-push-api.yml" + pull_request: + branches: + - main + paths: + - "stats-api/stats_api/**" + - "terraform/stats_api/**" + - ".github/workflows/lint-test-python.yml" + - ".github/workflows/build-push-api.yml" + workflow_dispatch: + inputs: + commit_sha: + description: Commit SHA to deploy (leave blank for latest) + required: false + type: string + jobs_to_run: + description: Job(s) to run + required: true + type: choice + options: + - "build and push" + - "build, push, deploy" + - "deploy only" + +jobs: + call-lint-test: + name: Stats API ${{ github.ref_name }} ${{ github.sha }} + uses: ./.github/workflows/lint-test-python.yml + with: + service_name: stats_api + + call-build-push: + if: ${{ inputs.jobs_to_run == "build and push" || inputs.jobs_to_run == "build, push, deploy" }} + name: Stats API ${{ github.ref_name }} ${{ github.sha }} + uses: ./.github/workflows/build-push-api.yml + with: + service_name: stats_api + dockerfile: "Dockerfile.api" + image_name: "stats-api" + port: "8080" + target: "runtime" + commit_sha: ${{ inputs.commit_sha || github.sha }} + + call-deploy: + if: ${{ inputs.jobs_to_run == "build, push, deploy" || inputs.jobs_to_run == "deploy only" }} + name: Stats API ${{ github.ref_name }} ${{ github.sha }} + uses: ./.github/workflows/deploy.yml + with: + service_name: stats_api + commit_sha: ${{ inputs.commit_sha || github.sha }} From 21a48e84ea2e813519b7eb5e8a349e55919c4d98 Mon Sep 17 00:00:00 2001 From: carly Date: Wed, 3 Dec 2025 12:00:19 -0500 Subject: [PATCH 3/7] format, rename --- .github/workflows/{lint-and-test-api.yml => lint-test-api.yml} | 0 terraform/stats_api/main.tf | 2 -- 2 files changed, 2 deletions(-) rename .github/workflows/{lint-and-test-api.yml => lint-test-api.yml} (100%) diff --git a/.github/workflows/lint-and-test-api.yml b/.github/workflows/lint-test-api.yml similarity index 100% rename from .github/workflows/lint-and-test-api.yml rename to .github/workflows/lint-test-api.yml diff --git a/terraform/stats_api/main.tf b/terraform/stats_api/main.tf index fd63216c..bf28d22c 100644 --- a/terraform/stats_api/main.tf +++ b/terraform/stats_api/main.tf @@ -59,8 +59,6 @@ resource "google_cloud_run_v2_service" "stats_api" { name = "stats-api" location = var.gcp_region - deletion_protection = false - template { service_account = google_service_account.account.email containers { From 59b65d806753c667220ae0ddccb69c164324451a Mon Sep 17 00:00:00 2001 From: carly Date: Wed, 3 Dec 2025 13:24:00 -0500 Subject: [PATCH 4/7] format, fix linting inputs --- .github/workflows/build-push-api.yml | 2 +- .github/workflows/deploy.yml | 3 ++- .github/workflows/lint-test-api.yml | 14 ++------------ .github/workflows/stats-api-triggers.yml | 12 +++++------- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-push-api.yml b/.github/workflows/build-push-api.yml index f6240daa..cc6741b6 100644 --- a/.github/workflows/build-push-api.yml +++ b/.github/workflows/build-push-api.yml @@ -12,7 +12,7 @@ on: required: false type: string image_name: - description: Name to be given to created image + description: Image name required: false type: string port: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index de8594fe..cf6bc99f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -36,7 +36,8 @@ jobs: deploy: runs-on: ubuntu-latest environment: ${{ inputs.environment || "development" }} - if: github.ref == "refs/heads/main" + # only deploy if merged to main + # if: github.ref == "refs/heads/main" steps: - name: Checkout code diff --git a/.github/workflows/lint-test-api.yml b/.github/workflows/lint-test-api.yml index dbf7273a..78428d6c 100644 --- a/.github/workflows/lint-test-api.yml +++ b/.github/workflows/lint-test-api.yml @@ -1,18 +1,8 @@ -name: Lint and test Python services +name: Lint and test stats api on: workflow_call: - inputs: - service_name: - type: string - description: The name of the service directory (e.g. stats_api) - required: true workflow_dispatch: - inputs: - service_name: - type: string - description: Name of the service directory (e.g. stats_api) - required: true permissions: contents: read @@ -25,7 +15,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: "Set up Python" + - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: "stats-api/pyproject.toml" diff --git a/.github/workflows/stats-api-triggers.yml b/.github/workflows/stats-api-triggers.yml index 602b41b2..a01931a9 100644 --- a/.github/workflows/stats-api-triggers.yml +++ b/.github/workflows/stats-api-triggers.yml @@ -15,7 +15,7 @@ on: paths: - "stats-api/stats_api/**" - "terraform/stats_api/**" - - ".github/workflows/lint-test-python.yml" + - ".github/workflows/lint-test-api.yml" - ".github/workflows/build-push-api.yml" workflow_dispatch: inputs: @@ -35,9 +35,7 @@ on: jobs: call-lint-test: name: Stats API ${{ github.ref_name }} ${{ github.sha }} - uses: ./.github/workflows/lint-test-python.yml - with: - service_name: stats_api + uses: ./.github/workflows/lint-test-api.yml call-build-push: if: ${{ inputs.jobs_to_run == "build and push" || inputs.jobs_to_run == "build, push, deploy" }} @@ -45,10 +43,10 @@ jobs: uses: ./.github/workflows/build-push-api.yml with: service_name: stats_api - dockerfile: "Dockerfile.api" - image_name: "stats-api" + dockerfile: Dockerfile.api + image_name: stats-api port: "8080" - target: "runtime" + target: runtime commit_sha: ${{ inputs.commit_sha || github.sha }} call-deploy: From 98fed39c3f7d8ac94c73d30ba9f10c968334794d Mon Sep 17 00:00:00 2001 From: carly Date: Wed, 3 Dec 2025 13:25:31 -0500 Subject: [PATCH 5/7] push comment to test workflow --- stats-api/stats_api/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stats-api/stats_api/factory.py b/stats-api/stats_api/factory.py index 166cc837..c3962659 100644 --- a/stats-api/stats_api/factory.py +++ b/stats-api/stats_api/factory.py @@ -38,4 +38,4 @@ def create_app(): host=app.config["HOST"], port=app.config["PORT"], debug=app.config["DEBUG"], - ) + ) # test From cc56cd69971eb6d6d59bd7fd2264858e93a39cd2 Mon Sep 17 00:00:00 2001 From: carly Date: Wed, 3 Dec 2025 13:36:22 -0500 Subject: [PATCH 6/7] update trigger conditions, comment for testing --- .github/workflows/build-push-api.yml | 2 +- .github/workflows/stats-api-triggers.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-push-api.yml b/.github/workflows/build-push-api.yml index cc6741b6..8579dd3d 100644 --- a/.github/workflows/build-push-api.yml +++ b/.github/workflows/build-push-api.yml @@ -67,5 +67,5 @@ jobs: - name: Push image # only push if merged to main - if: github.ref == "refs/heads/main" + # if: github.ref == "refs/heads/main" run: docker push --all-tags gcr.io/${{ env.GCP_PROJECT_ID }}/${{ inputs.image_name }} diff --git a/.github/workflows/stats-api-triggers.yml b/.github/workflows/stats-api-triggers.yml index a01931a9..57e64af4 100644 --- a/.github/workflows/stats-api-triggers.yml +++ b/.github/workflows/stats-api-triggers.yml @@ -38,7 +38,7 @@ jobs: uses: ./.github/workflows/lint-test-api.yml call-build-push: - if: ${{ inputs.jobs_to_run == "build and push" || inputs.jobs_to_run == "build, push, deploy" }} + if: ${{ github.event_name != "workflow_dispatch" || inputs.jobs_to_run == "build and push" || inputs.jobs_to_run == "build, push, deploy" }} name: Stats API ${{ github.ref_name }} ${{ github.sha }} uses: ./.github/workflows/build-push-api.yml with: @@ -50,7 +50,7 @@ jobs: commit_sha: ${{ inputs.commit_sha || github.sha }} call-deploy: - if: ${{ inputs.jobs_to_run == "build, push, deploy" || inputs.jobs_to_run == "deploy only" }} + if: ${{ github.event_name != "workflow_dispatch" || inputs.jobs_to_run == "build, push, deploy" || inputs.jobs_to_run == "deploy only" }} name: Stats API ${{ github.ref_name }} ${{ github.sha }} uses: ./.github/workflows/deploy.yml with: From 7be9c65291dc7bf99ef159582685e6d2657335e0 Mon Sep 17 00:00:00 2001 From: carly Date: Wed, 3 Dec 2025 13:52:34 -0500 Subject: [PATCH 7/7] add pr conditions to trigger on commit --- .github/workflows/stats-api-triggers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stats-api-triggers.yml b/.github/workflows/stats-api-triggers.yml index 57e64af4..c94cdca5 100644 --- a/.github/workflows/stats-api-triggers.yml +++ b/.github/workflows/stats-api-triggers.yml @@ -10,6 +10,7 @@ on: - ".github/workflows/deploy.yml" - ".github/workflows/build-push-api.yml" pull_request: + types: [opened, synchronize, reopened] branches: - main paths: