From 7fae58ee6082f5b924e7d839f60f0ef8c878877e Mon Sep 17 00:00:00 2001 From: Tanner Doshier Date: Fri, 27 Sep 2024 17:24:16 -0400 Subject: [PATCH] Manually update infra template to 4275fd01232d8563491d478aebfef8d14874469b --- .github/workflows/build-and-publish.yml | 6 +++++- .github/workflows/cd-app.yml | 9 +++++++-- .github/workflows/database-migrations.yml | 12 ++++++++++-- .github/workflows/deploy.yml | 11 ++++++++++- .template-version | 2 +- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index feb7f9af..acdc5d27 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -12,6 +12,10 @@ on: description: The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. Otherwise, use branch or tag that triggered the workflow run. required: true type: string + outputs: + commit_hash: + description: The SHA that was built + value: ${{ jobs.get-commit-hash.outputs.commit_hash }} workflow_dispatch: inputs: app_name: @@ -63,7 +67,7 @@ jobs: - name: Check if image is already published id: check-image-published run: | - is_image_published=$(./bin/is-image-published "${{ inputs.app_name }}" "${{ inputs.ref }}") + is_image_published=$(./bin/is-image-published "${{ inputs.app_name }}" "${{ needs.get-commit-hash.outputs.commit_hash }}") echo "Is image published: $is_image_published" echo "is_image_published=$is_image_published" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/cd-app.yml b/.github/workflows/cd-app.yml index ef11ece4..ba37e217 100644 --- a/.github/workflows/cd-app.yml +++ b/.github/workflows/cd-app.yml @@ -1,7 +1,7 @@ name: Deploy App # Need to set a default value for when the workflow is triggered from a git push # which bypasses the default configuration for inputs -run-name: Deploy ${{ github.ref_name }} to App ${{ inputs.environment || 'dev' }} +run-name: Deploy ${{ inputs.version || 'main' }} to App ${{ inputs.environment || 'dev' }} on: push: @@ -14,7 +14,7 @@ on: workflow_dispatch: inputs: environment: - description: "target environment" + description: Environment to deploy to required: true default: "dev" type: choice @@ -22,6 +22,10 @@ on: - dev - staging - prod + version: + required: true + default: "main" + description: Tag or branch or SHA to deploy jobs: deploy: @@ -30,3 +34,4 @@ jobs: with: app_name: "app" environment: ${{ inputs.environment || 'dev' }} + version: ${{ inputs.version || 'main' }} diff --git a/.github/workflows/database-migrations.yml b/.github/workflows/database-migrations.yml index 12185189..e8371877 100644 --- a/.github/workflows/database-migrations.yml +++ b/.github/workflows/database-migrations.yml @@ -11,6 +11,14 @@ on: description: "the name of the application environment (e.g. dev, staging, prod)" required: true type: string + version: + description: "git reference to deploy (e.g., a branch, tag, or commit SHA)" + required: true + type: string + outputs: + commit_hash: + description: The SHA that was used for migrations + value: ${{ jobs.build-and-publish.outputs.commit_hash }} concurrency: database-migrations-${{ inputs.app_name }}-${{ inputs.environment }} @@ -20,7 +28,7 @@ jobs: uses: ./.github/workflows/build-and-publish.yml with: app_name: ${{ inputs.app_name }} - ref: ${{ github.ref }} + ref: ${{ inputs.version }} run-migrations: name: Run migrations runs-on: ubuntu-latest @@ -44,4 +52,4 @@ jobs: - name: Run migrations run: | - make release-run-database-migrations APP_NAME=${{ inputs.app_name }} ENVIRONMENT=${{ inputs.environment }} + make release-run-database-migrations APP_NAME=${{ inputs.app_name }} ENVIRONMENT=${{ inputs.environment }} IMAGE_TAG=${{ needs.build-and-publish.outputs.commit_hash }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 074c8a7e..d4b6fba1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,6 +11,14 @@ on: description: "the name of the application environment (e.g. dev, staging, prod)" required: true type: string + version: + description: "git reference to deploy (e.g., a branch, tag, or commit SHA)" + required: true + type: string + outputs: + commit_hash: + description: The SHA that was deployed + value: ${{ jobs.database-migrations.outputs.commit_hash }} concurrency: cd-${{inputs.app_name}}-${{ inputs.environment }} @@ -23,6 +31,7 @@ jobs: with: app_name: ${{ inputs.app_name }} environment: ${{ inputs.environment }} + version: ${{ inputs.version }} deploy: name: Deploy runs-on: ubuntu-latest @@ -43,4 +52,4 @@ jobs: environment: ${{ inputs.environment }} - name: Deploy release - run: make release-deploy APP_NAME=${{ inputs.app_name }} ENVIRONMENT=${{ inputs.environment }} + run: make release-deploy APP_NAME=${{ inputs.app_name }} ENVIRONMENT=${{ inputs.environment }} IMAGE_TAG=${{ needs.database-migrations.outputs.commit_hash }} diff --git a/.template-version b/.template-version index a9d90486..e6437456 100644 --- a/.template-version +++ b/.template-version @@ -1 +1 @@ -7ce266a2675b46af31a48e1e7cc9f6acb7aeecc0 +4275fd01232d8563491d478aebfef8d14874469b