Skip to content

Commit

Permalink
simplify tear down steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ebronson68 committed Oct 11, 2023
1 parent 5c12fab commit f055cb8
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/ephemeral-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,35 +250,20 @@ jobs:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- name: Login via Az module
uses: azure/login@v1
with:
creds: "${{ secrets.azureCredentials }}"

- name: Delete Azure Resources
run: |
az containerapp delete --resource-group ${{ inputs.clusterResourceGroup }} --name ${{ needs.prepare.outputs.repositoryName }}-${{ needs.prepare.outputs.jiraTicketIdLc }} --yes
az acr repository delete -n ${{ secrets.registryHostName }} --image ${{ inputs.dockerImageName }}:${{ needs.prepare.outputs.jiraTicketId }} --yes
- name: Generate .env file from Azure Key Vaults
uses: Andrews-McMeel-Universal/get-envs@v1
with:
environment: ${{ inputs.environment }}
azurecredentials: ${{ secrets.azureCredentials }}
environmentKeyVault: ${{ inputs.environmentKeyVault }}

- name: Set environment variables
id: env-vars
shell: bash
- name: Delete Azure Resources
run: |
ENVIRONMENT_VARIABLES=$(tr "\n" " " < .env)
TARGET_PORT=$(find . -iname "values.yaml" -exec grep "targetPort: " {} \; | awk -F ': ' '{print $2}' | uniq)
echo "targetPort=${TARGET_PORT}" >> $GITHUB_OUTPUT
echo "environmentVariables=${ENVIRONMENT_VARIABLES}" >> $GITHUB_OUTPUT
az containerapp delete --resource-group ${{ inputs.clusterResourceGroup }} --name ${{ needs.prepare.outputs.repositoryName }}-${{ needs.prepare.outputs.jiraTicketIdLc }} --yes
az acr repository delete -n ${{ secrets.registryHostName }} --image ${{ inputs.dockerImageName }}:${{ needs.prepare.outputs.jiraTicketId }} --yes
- name: Remove Azure B2C Redirect URI
if: contains(steps.env-vars.outputs.environmentVariables, 'BASE_URL')
if: ${{ env.NEXT_PUBLIC_BASE_URL || env.BASE_URL || env.NEXTAUTH_URL }}
run: |
az login --service-principal --username "${{ env.B2C_CLIENT_ID }}" --password "${{ env.B2C_CLIENT_SECRET }}" --tenant "${{ env.B2C_TENANT_NAME }}.onmicrosoft.com" --allow-no-subscriptions
REDIRECT_URIS=()
Expand Down

0 comments on commit f055cb8

Please sign in to comment.