mirror of
https://github.com/bartvdbraak/keyweave.git
synced 2025-04-28 15:21:21 +00:00
feat: add checks and git tags for azure deployed
This commit is contained in:
parent
fc01fd091e
commit
d3ad568851
1 changed files with 37 additions and 13 deletions
50
.github/workflows/tests.yml
vendored
50
.github/workflows/tests.yml
vendored
|
@ -21,19 +21,43 @@ jobs:
|
||||||
LOCATION: eastus
|
LOCATION: eastus
|
||||||
DEPLOYMENT_NAME: keyweave-${{ github.run_id }}
|
DEPLOYMENT_NAME: keyweave-${{ github.run_id }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: azure/login@v1
|
|
||||||
with:
|
- name: Fetch complete history
|
||||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
run: git fetch --prune --unshallow
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
- name: Get last deployed commit
|
||||||
- name: Deploy Bicep template
|
id: last_deployed
|
||||||
uses: azure/arm-deploy@v1
|
run: echo "LAST_DEPLOYED_COMMIT=$(git rev-list -n 1 deployed)" >> $GITHUB_ENV
|
||||||
with:
|
|
||||||
scope: subscription
|
- name: Check for changes in bicep folder
|
||||||
region: ${{ env.LOCATION }}
|
run: |
|
||||||
template: bicep/main.bicep
|
if git diff --quiet $LAST_DEPLOYED_COMMIT HEAD -- bicep/ ; then
|
||||||
deploymentName: ${{ env.DEPLOYMENT_NAME }}
|
echo "NO_CHANGES=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "NO_CHANGES=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- if: env.NO_CHANGES == 'false'
|
||||||
|
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.NO_CHANGES == 'false'
|
||||||
|
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.NO_CHANGES == 'false'
|
||||||
|
name: Tag Deployment
|
||||||
|
run: |
|
||||||
|
git tag -fa deployed -m "Deployed to Azure"
|
||||||
|
git push origin --tags --force
|
||||||
|
|
||||||
tests-no-access:
|
tests-no-access:
|
||||||
name: Tests with No Access
|
name: Tests with No Access
|
||||||
|
|
Loading…
Reference in a new issue