Skip to content

Commit

Permalink
Manually update infra template to 4275fd01232d8563491d478aebfef8d1487…
Browse files Browse the repository at this point in the history
…4469b
  • Loading branch information
doshitan committed Sep 30, 2024
1 parent 296b8d0 commit 7fae58e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/cd-app.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -14,14 +14,18 @@ on:
workflow_dispatch:
inputs:
environment:
description: "target environment"
description: Environment to deploy to
required: true
default: "dev"
type: choice
options:
- dev
- staging
- prod
version:
required: true
default: "main"
description: Tag or branch or SHA to deploy

jobs:
deploy:
Expand All @@ -30,3 +34,4 @@ jobs:
with:
app_name: "app"
environment: ${{ inputs.environment || 'dev' }}
version: ${{ inputs.version || 'main' }}
12 changes: 10 additions & 2 deletions .github/workflows/database-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand All @@ -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 }}
11 changes: 10 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -23,6 +31,7 @@ jobs:
with:
app_name: ${{ inputs.app_name }}
environment: ${{ inputs.environment }}
version: ${{ inputs.version }}
deploy:
name: Deploy
runs-on: ubuntu-latest
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion .template-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7ce266a2675b46af31a48e1e7cc9f6acb7aeecc0
4275fd01232d8563491d478aebfef8d14874469b

1 comment on commit 7fae58e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report for app

St.
Category Percentage Covered / Total
🟢 Statements 93.1% 81/87
🟢 Branches 82.35% 14/17
🟢 Functions 93.33% 14/15
🟢 Lines 93.59% 73/78

Test suite run success

16 tests passing in 5 suites.

Report generated by 🧪jest coverage report action from 7fae58e

Please sign in to comment.