WordPress Deployment #55
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
# This workflow will deploy WordPress on Azure Container Apps | |
name: WordPress Deployment | |
on: | |
workflow_dispatch: | |
push: | |
# Run when commits are pushed to mainline branch | |
# Set this to the mainline branch you are using | |
branches: | |
- main | |
- master | |
schedule: | |
- cron: "0 10 * * 6" | |
# Set this permission if you are using a Federated Credential. | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
Test: | |
runs-on: ubuntu-latest | |
# azd build-in variables. | |
# This variables are always set by `azd pipeline config` | |
# You can set them as global env (apply to all steps) or you can add them to individual steps' environment | |
env: | |
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
# This env var is required only by the first step that uses azd (provision, up, deploy, etc) to create the env config | |
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }} | |
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} | |
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | |
## Define the additional variables or secrets that are required globally (provision and deploy) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# using the install-azd action | |
- name: Install azd | |
uses: Azure/[email protected] | |
# # If you want to use azd-daily build, or install it from a PR, you can remove previous step and | |
# # use the next one: | |
# - name: Install azd - daily or from PR | |
# # Update this scrip based on the OS - pool of your pipeline. This example is for a linux pipeline installing daily build | |
# run: curl -fsSL https://aka.ms/install-azd.sh | bash -s -- --version daily | |
# shell: pwsh | |
# azd set up Federated Credential by default. You can remove this step if you are using Client Credentials | |
- name: Log in with Azure (Federated Credentials) | |
if: ${{ env.AZURE_CLIENT_ID != '' }} | |
run: | | |
azd auth login ` | |
--client-id "$Env:AZURE_CLIENT_ID" ` | |
--federated-credential-provider "github" ` | |
--tenant-id "$Env:AZURE_TENANT_ID" | |
shell: pwsh | |
- name: Provision Infrastructure | |
run: azd up --no-prompt | |
- name: Tear Down Infrastructure | |
run: azd down --no-prompt --force --purge |