exclude docs and assets from pr trigger #29
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: Test Build for PR | |
on: | |
pull_request: | |
types: [ opened, edited, reopened] | |
branches: [ main ] | |
paths-ignore: | |
- 'docs/**' | |
- 'assets/**' | |
workflow_dispatch: | |
jobs: | |
prepare-test: | |
name: 'Prepare Test Run' | |
runs-on: ubuntu-latest | |
outputs: | |
DEPLOYMENTNAME: ${{ steps.make-name.outputs.DEPLOYMENTNAME }} | |
steps: | |
- name: Compose deployment name | |
uses: azure/powershell@v2 | |
id: make-name | |
with: | |
azPSVersion: "latest" | |
inlineScript: | | |
if($env:GITHUB_EVENT_NAME -eq "pull_request") { | |
$deploymentName = "ctpr${{ github.event.number }}" | |
} | |
else { | |
$sha = $env:GITHUB_SHA.Substring(0, 4) | |
$deploymentName = "ct$sha" | |
} | |
echo "DEPLOYMENTNAME=$deploymentName" >> $env:GITHUB_OUTPUT | |
run-build-deploy: | |
name: 'Run Build and Deploy pipeline' | |
uses: ./.github/workflows/build-deploy.yml | |
needs: [prepare-test] | |
with: | |
DEPLOYMENT_NAME: '${{ needs.prepare-test.outputs.DEPLOYMENTNAME }}' | |
secrets: inherit | |
delete-resources: | |
name: 'Delete Azure Resources' | |
# Run this job even if the previous job fails: | |
if: always() | |
needs: [run-build-deploy] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@main | |
- name: 'Login via Azure CLI' | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
enable-AzPSSession: true | |
- name: Download Deployment Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploymentOutput | |
- name: Parse Deployment Output | |
uses: azure/powershell@v2 | |
with: | |
azPSVersion: "latest" | |
inlineScript: | | |
$deploymentOutput = Get-Content "output.deployment.json" | ConvertFrom-Json -Depth 10 | |
$deploymentOutput.psobject.properties | ForEach-Object { | |
("{0}={1}" -f ($_.Name).ToUpper(), $_.Value.Value) | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
} | |
- name: Delete Resource Group | |
uses: azure/cli@v2 | |
with: | |
azPSVersion: "latest" | |
inlineScript: | | |
az group delete --name '${{ env.RG_NAME }}' --yes --no-wait |