Skip to content

mlouage is building the website #25

mlouage is building the website

mlouage is building the website #25

Workflow file for this run

name: PR workflow
run-name: ${{ github.actor }} is building the website
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, closed]
permissions:
id-token: write
contents: read
jobs:
ci:
runs-on: ubuntu-latest
environment: preview
name: CI
if: github.event.action != 'closed'
steps:
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
slug-maxlength: 11
- name: "Login to ACR"
run: |
set -euo pipefail
access_token=$(az account get-access-token --query accessToken -o tsv)
refresh_token=$(curl https://${{ secrets.REGISTRY_NAME }}.azurecr.io/oauth2/exchange -v -d "grant_type=access_token&service=${{ secrets.REGISTRY_NAME }}.azurecr.io&access_token=$access_token" | jq -r .refresh_token)
docker login -u 00000000-0000-0000-0000-000000000000 --password-stdin ${{ secrets.REGISTRY_NAME }}.azurecr.io <<< "$refresh_token"
- name: Build and push container image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ secrets.REGISTRY_NAME }}.azurecr.io/website:${{ env.GITHUB_REF_NAME_SLUG }}
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Deploy website
uses: azure/arm-deploy@v1
with:
scope: subscription
region: westeurope
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
template: ./deploy/main.bicep
parameters: imageTag=${{ env.GITHUB_REF_NAME_SLUG }}
failOnStdErr: false
remove_container_appp:
runs-on: ubuntu-latest
environment: preview
name: Remove container app
if: github.event.action == 'closed'
steps:
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
slug-maxlength: 11
- name: Remove container app
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az containerapp delete -g rg-xprtzbv-website -n ctap-xprtzbv-website-${{ env.GITHUB_REF_NAME_SLUG }} -y