mirror of
https://github.com/bartvdbraak/keyweave.git
synced 2025-04-28 07:11:21 +00:00
feat: add pre-check before bicep jobs
This commit is contained in:
parent
b78ab280f1
commit
563c52178a
1 changed files with 49 additions and 41 deletions
34
.github/workflows/tests.yml
vendored
34
.github/workflows/tests.yml
vendored
|
@ -11,15 +11,13 @@ on:
|
|||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
bicep:
|
||||
name: Deploy Azure resources
|
||||
bicep-pre-check:
|
||||
name: Bicep Pre-check
|
||||
environment: bicep
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: bicep
|
||||
env:
|
||||
LOCATION: eastus
|
||||
DEPLOYMENT_NAME: keyweave-${{ github.run_id }}
|
||||
outputs:
|
||||
deployed_tag_exists: ${{ steps.check_tag.outputs.DEPLOYED_TAG_EXISTS }}
|
||||
no_changes: ${{ steps.check_tag.outputs.NO_CHANGES }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Fetch complete history
|
||||
|
@ -41,22 +39,32 @@ jobs:
|
|||
else
|
||||
echo "NO_CHANGES=false" >> $GITHUB_ENV
|
||||
fi
|
||||
- if: env.DEPLOYED_TAG_EXISTS == 'false' || env.NO_CHANGES == 'false'
|
||||
uses: azure/login@v1
|
||||
bicep:
|
||||
name: Deploy Azure resources
|
||||
needs: bicep-pre-check
|
||||
if: ${{ needs.bicep-pre-check.outputs.deployed_tag_exists }} == 'false' || ${{ needs.bicep-pre-check.outputs.no_changes }} == 'false'
|
||||
environment: bicep
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: bicep
|
||||
env:
|
||||
LOCATION: eastus
|
||||
DEPLOYMENT_NAME: keyweave-${{ github.run_id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: azure/login@v1
|
||||
with:
|
||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||
- if: env.DEPLOYED_TAG_EXISTS == 'false' || env.NO_CHANGES == 'false'
|
||||
name: Deploy Bicep template
|
||||
- name: Deploy Bicep template
|
||||
uses: azure/arm-deploy@v1
|
||||
with:
|
||||
scope: subscription
|
||||
region: ${{ env.LOCATION }}
|
||||
template: bicep/main.bicep
|
||||
deploymentName: ${{ env.DEPLOYMENT_NAME }}
|
||||
- if: env.DEPLOYED_TAG_EXISTS == 'false' || env.NO_CHANGES == 'false'
|
||||
name: Tag Deployment
|
||||
- name: Tag Deployment
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
|
Loading…
Reference in a new issue