Skip to content

Bump Azure.Identity from 1.10.1 to 1.10.2 in /src/GordonBeemingCom.Shared #266

Bump Azure.Identity from 1.10.1 to 1.10.2 in /src/GordonBeemingCom.Shared

Bump Azure.Identity from 1.10.1 to 1.10.2 in /src/GordonBeemingCom.Shared #266

Workflow file for this run

name: publish
on:
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
SITE_IMAGE_NAME: ${{ github.repository }}
EDITOR_IMAGE_NAME: ${{ github.repository }}editor
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata (site)
id: meta-site
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/${{ env.SITE_IMAGE_NAME }}
tags: |
type=sha,format=long,prefix=,priority=100
type=sha,prefix=,priority=80
type=ref,event=branch,priority=60
type=ref,event=pr,priority=40
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image (site)
id: build-and-push-site
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-site.outputs.tags }}
file: "src/GordonBeemingCom/Dockerfile"
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata (editor)
id: meta-editor
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/${{ env.EDITOR_IMAGE_NAME }}
tags: |
type=sha,format=long,prefix=,priority=100
type=sha,prefix=,priority=80
type=ref,event=branch,priority=60
type=ref,event=pr,priority=40
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image (editor)
id: build-and-push-editor
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-editor.outputs.tags }}
file: "src/GordonBeemingCom.Editor/Dockerfile"
deployPreview:
name: "Deploy to Preview"
needs: build
if: github.ref == 'refs/heads/main'
concurrency:
group: preview
cancel-in-progress: false
environment:
name: "preview"
url: "https://preview.gordonbeeming.com/"
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
- name: Deploy Web App to Preview (editor)
uses: Azure/[email protected]
with:
inlineScript: |
TAG=$(echo 'https://${{ env.REGISTRY }}/${{ env.EDITOR_IMAGE_NAME }}:${{ github.sha }}' | tr '[:upper:]' '[:lower:]')
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.EDITOR_AZURE_WEBAPP_NAME }} --settings BRANCH_NAME=${{ github.ref_name }}
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.EDITOR_AZURE_WEBAPP_NAME }} --settings COMMIT_HASH=${{ github.sha }}
az webapp config container set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.EDITOR_AZURE_WEBAPP_NAME }} --docker-custom-image-name $TAG
- name: Deploy Web App to Preview (site)
uses: Azure/[email protected]
with:
inlineScript: |
TAG=$(echo 'https://${{ env.REGISTRY }}/${{ env.SITE_IMAGE_NAME }}:${{ github.sha }}' | tr '[:upper:]' '[:lower:]')
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.SITE_AZURE_WEBAPP_NAME }} --settings BRANCH_NAME=${{ github.ref_name }}
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.SITE_AZURE_WEBAPP_NAME }} --settings COMMIT_HASH=${{ github.sha }}
az webapp config container set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.SITE_AZURE_WEBAPP_NAME }} --docker-custom-image-name $TAG
- name: Azure Logout
uses: azure/CLI@v1
with:
inlineScript: |
az logout
deployLive:
name: "Deploy to live"
needs: deployPreview
if: github.ref == 'refs/heads/main'
concurrency:
group: live
cancel-in-progress: false
environment:
name: "live"
url: "https://gordonbeeming.com/"
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
- name: Deploy Web App to Live (editor)
uses: Azure/[email protected]
with:
inlineScript: |
TAG=$(echo 'https://${{ env.REGISTRY }}/${{ env.EDITOR_IMAGE_NAME }}:${{ github.sha }}' | tr '[:upper:]' '[:lower:]')
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.EDITOR_AZURE_WEBAPP_NAME }} --settings BRANCH_NAME=${{ github.ref_name }}
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.EDITOR_AZURE_WEBAPP_NAME }} --settings COMMIT_HASH=${{ github.sha }}
az webapp config container set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.EDITOR_AZURE_WEBAPP_NAME }} --docker-custom-image-name $TAG
- name: Deploy Web App to Live (site)
uses: Azure/[email protected]
with:
inlineScript: |
TAG=$(echo 'https://${{ env.REGISTRY }}/${{ env.SITE_IMAGE_NAME }}:${{ github.sha }}' | tr '[:upper:]' '[:lower:]')
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.SITE_AZURE_WEBAPP_NAME }} --settings BRANCH_NAME=${{ github.ref_name }}
az webapp config appsettings set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.SITE_AZURE_WEBAPP_NAME }} --settings COMMIT_HASH=${{ github.sha }}
az webapp config container set --resource-group ${{ secrets.AZURE_WEBAPP_RG }} --name ${{ secrets.SITE_AZURE_WEBAPP_NAME }} --docker-custom-image-name $TAG
- name: Azure Logout
uses: azure/CLI@v1
with:
inlineScript: |
az logout