Skip to content

Commit

Permalink
Merge branch 'main' into widal001/2590-call-github-api-from-python
Browse files Browse the repository at this point in the history
  • Loading branch information
widal001 authored Jan 17, 2025
2 parents e347dba + dca1e2c commit c285fb8
Show file tree
Hide file tree
Showing 330 changed files with 7,057 additions and 10,892 deletions.
17 changes: 17 additions & 0 deletions .github/actions/setup-terraform/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Set up Terraform"
description: "Set up Terraform with the version stored in the .terraform-version file"
runs:
using: "composite"
steps:
- name: Get .terraform-version
id: get-terraform-version
run: |
terraform_version="$(cat .terraform-version)"
echo "Terraform version: ${terraform_version}"
echo "terraform_version=${terraform_version}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ steps.get-terraform-version.outputs.terraform_version }}
terraform_wrapper: false
44 changes: 28 additions & 16 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build and Publish
run-name: Build and Publish ${{ inputs.ref }} to ${{ inputs.app_name }} ${{ inputs.environment || (github.event_name == 'release' && 'prod') || 'nonprod' }}
name: Build and publish
run-name: Build and publish ${{ inputs.app_name }}:${{ inputs.ref }}

on:
workflow_call:
Expand All @@ -12,11 +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
environment:
description: "The environment where the build will be deployed. eg. dev or prod. Will default to dev."
default: dev
required: false
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 All @@ -27,27 +26,40 @@ 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
environment:
description: "The environment where the build will be deployed. eg. dev or prod. Will default to dev."
default: dev
required: false
type: string

jobs:
get-commit-hash:
name: Get commit hash
runs-on: ubuntu-22.04
outputs:
commit_hash: ${{ steps.get-commit-hash.outputs.commit_hash }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Get commit hash
id: get-commit-hash
run: |
COMMIT_HASH=$(git rev-parse ${{ inputs.ref }})
echo "Commit hash: $COMMIT_HASH"
echo "commit_hash=$COMMIT_HASH" >> "$GITHUB_OUTPUT"
build-and-publish:
name: Build and publish
runs-on: ubuntu-22.04
needs: get-commit-hash
concurrency: ${{ github.workflow }}-${{ needs.get-commit-hash.outputs.commit_hash }}

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.7
terraform_wrapper: false
ref: ${{ inputs.ref }}

- name: Set up Terraform
uses: ./.github/actions/setup-terraform

- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
Expand All @@ -58,7 +70,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
84 changes: 0 additions & 84 deletions .github/workflows/cd-analytics-infra.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/cd-analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "main"
paths:
- "analytics/**"
- "infra/analytics/**"
release:
types: [published]
workflow_dispatch:
Expand All @@ -20,6 +21,10 @@ on:
- dev
- staging
- prod
version:
required: true
default: "main"
description: Tag or branch or SHA to deploy

jobs:
analytics-checks:
Expand All @@ -45,6 +50,7 @@ jobs:
with:
app_name: "analytics"
environment: ${{ matrix.envs }}
version: ${{ inputs.version || github.ref }}

send-slack-notification:
if: failure()
Expand Down
84 changes: 0 additions & 84 deletions .github/workflows/cd-api-infra.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/cd-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "main"
paths:
- "api/**"
- "infra/api/**"
release:
types: [published]
workflow_dispatch:
Expand All @@ -20,6 +21,10 @@ on:
- dev
- staging
- prod
version:
required: true
default: "main"
description: Tag or branch or SHA to deploy

jobs:
api-checks:
Expand All @@ -44,6 +49,7 @@ jobs:
with:
app_name: "api"
environment: ${{ matrix.envs }}
version: ${{ inputs.version || github.ref }}

send-slack-notification:
if: failure()
Expand Down
Loading

0 comments on commit c285fb8

Please sign in to comment.