New Database Operations #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Database Operations | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: 'Choose Environment' | |
required: true | |
default: 'dev' | |
options: | |
- 'dev' | |
- 'sb' | |
- 'prod' | |
tag: | |
type: string | |
description: 'Image Tag' | |
required: true | |
default: '' | |
workflow_call: | |
inputs: | |
environment: | |
type: string | |
description: 'Environment' | |
required: true | |
default: 'dev' | |
tag: | |
type: string | |
description: 'Image Tag' | |
required: true | |
default: '' | |
# workflow_dispatch: | |
# inputs: | |
# environment: | |
# description: 'Select environment' | |
# type: choice | |
# options: | |
# - dev | |
# - sb | |
# - prod | |
# required: true | |
# data-sync: | |
# description: 'Run data sync' | |
# type: boolean | |
# default: false | |
# data-migration: | |
# description: 'Run data migration' | |
# type: boolean | |
# default: false | |
# prisma-migration: | |
# description: 'Run Prisma migration' | |
# type: boolean | |
# default: false | |
jobs: | |
# database-ops: | |
# runs-on: ubuntu-latest | |
# environment: ${{ github.event.inputs.environment }} | |
# permissions: | |
# id-token: write | |
# contents: read | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - name: Install pnpm | |
# uses: pnpm/action-setup@v2 | |
# with: | |
# version: 8 | |
# run_install: false | |
# - name: Install Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version-file: ".nvmrc" | |
# registry-url: https://registry.npmjs.org | |
# cache: 'pnpm' | |
# - name: Configure AWS Credentials | |
# uses: aws-actions/configure-aws-credentials@v4 | |
# with: | |
# aws-region: ${{ secrets.AWS_REGION }} | |
# role-to-assume: ${{ secrets.AWS_IAM_ROLE }} | |
# role-session-name: MySessionName | |
# role-duration-seconds: 300 | |
# - name: Get secrets | |
# uses: aws-actions/aws-secretsmanager-get-secrets@v2 | |
# with: | |
# secret-ids: ${{ secrets.AWS_SECRET_MANAGER_WORKFLOW_NAME }} | |
# - name: Setup Twingate | |
# uses: twingate/github-action@v1 | |
# with: | |
# service-key: ${{ secrets.TWINGATE_SERVICE_KEY_SECRET_NAME }} | |
# - name: Install dependencies | |
# run: npm install --legacy-peer-deps | |
# - name: Run Data Sync | |
# if: ${{ github.event.inputs.data-sync == 'true' }} | |
# run: dumb-init npm run db:data-sync | |
# env: | |
# NODE_ENV: ${{ github.event.inputs.environment }} | |
# - name: Run Data Migration | |
# if: ${{ github.event.inputs.data-migration == 'true' }} | |
# run: dumb-init npm run db:data-migration:migrate | |
# env: | |
# NODE_ENV: ${{ github.event.inputs.environment }} | |
# - name: Run Prisma Migration | |
# if: ${{ github.event.inputs.prisma-migration == 'true' }} | |
# run: dumb-init npm run db:migrate-up | |
# env: | |
# NODE_ENV: ${{ github.event.inputs.environment }} | |
update-helm-chart: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Checkout cloud-infra-config repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ballerine-io/cloud-infra-config | |
token: ${{ secrets.GIT_TOKEN }} | |
ref: main | |
fetch-depth: 1 | |
sparse-checkout: | | |
kubernetes/helm/wf-service-migration | |
sparse-checkout-cone-mode: true | |
- name: Check if values yaml file exists | |
id: update_helm_check | |
shell: bash | |
run: | | |
if [ -f "kubernetes/helm/wf-service-migration/${{ inputs.environment }}-custom-values.yaml" ]; then | |
echo "file_name=${{ inputs.environment }}-custom-values.yaml" >> "$GITHUB_OUTPUT" | |
elif [ "${{ inputs.environment }}" == "dev" ]; then | |
echo "file_name=dev-custom-values.yaml" >> "$GITHUB_OUTPUT" | |
else | |
echo "skip_helm=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Update workflow-service image version in the HelmChart | |
if: ${{ steps.update_helm_check.outputs.skip_helm != 'true' }} | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
repository: ballerine-io/cloud-infra-config | |
branch: main | |
commitChange: true | |
message: 'Update wf-service image Version to ${{ inputs.tag }} - (Commit hash: ${{ github.sha }}, commit message: ${{ github.event.head_commit.message }})' | |
token: ${{ secrets.GIT_TOKEN }} | |
changes: | | |
{ | |
"kubernetes/helm/wf-service-migration/${{steps.update_helm_check.outputs.file_name}}": { | |
"prismaMigrate.image.tag": "${{ inputs.tag }}", | |
"dbMigrate.image.tag": "${{ inputs.tag }}", | |
"dataSync.image.tag": "${{ inputs.tag }}" | |
} | |
} |