Skip to content

Commit

Permalink
use environment...
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Oct 15, 2024
1 parent f4e39be commit 324427b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 41 deletions.
4 changes: 0 additions & 4 deletions .github/actions/tf-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ runs:
working-directory: ./ops/terraform
shell: bash
env:
SUBSCRIPTION_ID: ${{ inputs.azure-subscription-id }}
RESOURCE_GROUP_NAME: ${{ inputs.azure-resource-group }}
CLIENT_ID: ${{ inputs.azure-client-id }}
run: |
# echo subscription_id=\""$SUBSCRIPTION_ID"\" >> terraform.tfvars
echo resource_group_name=\""$RESOURCE_GROUP_NAME"\" >> terraform.tfvars
# echo client_id=\""$CLIENT_ID"\" >> terraform.tfvars
echo name=\""$NAME"\" >> terraform.tfvars
az config set defaults.group=$RESOURCE_GROUP_NAME
- name: Set environment
Expand Down
51 changes: 14 additions & 37 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ permissions:

env:
NODE_VERSION: 20
APP_NAME: reportversion
DEPLOY_ENV: dev2
OCR_API_URL: 'https://reportvision-ocr-api-dev.azurewebsites.net/'
SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}

jobs:
build_publish_ocr:
Expand Down Expand Up @@ -66,45 +68,20 @@ jobs:
env-setup:
runs-on: ubuntu-latest
# needs: [build_frontend, build_docker_ocr]
environment: dev2
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Load input variables
working-directory: ./ops/terraform
shell: bash
env:
RESOURCE_GROUP_NAME: ${{ env.APP_NAME}}-rg-${{ env.DEPLOY_ENV }}
run: |
echo resource_group_name=\""$RESOURCE_GROUP_NAME"\" >> terraform.tfvars
echo name=\""$APP_NAME"\" >> terraform.tfvars
az config set defaults.group=$RESOURCE_GROUP_NAME
- name: Set environment
shell: bash
id: set-environment
run: |-
echo "tf-env=$(
echo ${DEPLOY_ENV}
)" >> $GITHUB_OUTPUT
- name: Terraform deploy
working-directory: ./ops/terraform
env:
TF_ENV: ${{ steps.set-environment.outputs.tf-env }}
shell: bash
run: |
terraform init -backend-config=config/$TF_ENV.config
terraform workspace select -or-create $TF_ENV
terraform plan -lock-timeout=30m
terraform apply -auto-approve -lock-timeout=30m
# - uses: ./.github/actions/tf-setup
# name: Setup this environment with Terraform
# with:
# deploy-env: dev2
# azure-resource-group: reportvision-rg-dev2
# # azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
# # azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# # azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# app-name: reportvision
- uses: ./.github/actions/tf-setup
name: Setup this environment with Terraform
with:
deploy-env: dev2
azure-resource-group: reportvision-rg-dev2
# azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
# azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
app-name: reportvision

0 comments on commit 324427b

Please sign in to comment.