Bump docker/setup-buildx-action from 2.9.1 to 3.0.0 #224
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: 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@v3 | |
# 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@465a07811f14bebb1938fbed4728c6a1ff8901fc | |
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@818d4b7b91585d195f67373fd9cb0332e31a7175 | |
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@2eb1c1961a95fc15694676618e422e8ba1d63825 | |
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@818d4b7b91585d195f67373fd9cb0332e31a7175 | |
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@2eb1c1961a95fc15694676618e422e8ba1d63825 | |
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 | |