diff --git a/.github/actions/tf-setup/action.yml b/.github/actions/tf-setup/action.yml index 3318ca43..7b92c9cd 100644 --- a/.github/actions/tf-setup/action.yml +++ b/.github/actions/tf-setup/action.yml @@ -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 diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 737e5d76..e78463c1 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -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: @@ -66,6 +68,7 @@ jobs: env-setup: runs-on: ubuntu-latest # needs: [build_frontend, build_docker_ocr] + environment: dev2 steps: - uses: actions/checkout@v4 - uses: azure/login@v2 @@ -73,38 +76,12 @@ jobs: 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 \ No newline at end of file + - 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 \ No newline at end of file