mirror of
https://github.com/bartvdbraak/keyweave.git
synced 2025-04-28 15:21: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 ]
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bicep:
|
bicep-pre-check:
|
||||||
name: Deploy Azure resources
|
name: Bicep Pre-check
|
||||||
environment: bicep
|
environment: bicep
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
outputs:
|
||||||
group: bicep
|
deployed_tag_exists: ${{ steps.check_tag.outputs.DEPLOYED_TAG_EXISTS }}
|
||||||
env:
|
no_changes: ${{ steps.check_tag.outputs.NO_CHANGES }}
|
||||||
LOCATION: eastus
|
|
||||||
DEPLOYMENT_NAME: keyweave-${{ github.run_id }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Fetch complete history
|
- name: Fetch complete history
|
||||||
|
@ -41,22 +39,32 @@ jobs:
|
||||||
else
|
else
|
||||||
echo "NO_CHANGES=false" >> $GITHUB_ENV
|
echo "NO_CHANGES=false" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
- if: env.DEPLOYED_TAG_EXISTS == 'false' || env.NO_CHANGES == 'false'
|
bicep:
|
||||||
uses: azure/login@v1
|
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:
|
with:
|
||||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_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
|
uses: azure/arm-deploy@v1
|
||||||
with:
|
with:
|
||||||
scope: subscription
|
scope: subscription
|
||||||
region: ${{ env.LOCATION }}
|
region: ${{ env.LOCATION }}
|
||||||
template: bicep/main.bicep
|
template: bicep/main.bicep
|
||||||
deploymentName: ${{ env.DEPLOYMENT_NAME }}
|
deploymentName: ${{ env.DEPLOYMENT_NAME }}
|
||||||
- if: env.DEPLOYED_TAG_EXISTS == 'false' || env.NO_CHANGES == 'false'
|
- name: Tag Deployment
|
||||||
name: Tag Deployment
|
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
Loading…
Reference in a new issue