edit date for Sunday session update image #428
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: Azure Static Web Apps CI/CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
jobs: | |
check-secrets: | |
name: Check repo secrets | |
runs-on: ubuntu-latest | |
outputs: | |
azure: ${{ steps.set_output.outputs.azure }} | |
steps: | |
# Secrets cannot be used as if condition, use job output as workaround. | |
# https://github.com/actions/runner/issues/520 | |
- id: set_output | |
env: | |
AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_MUSHROOM_00D947803: '${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_MUSHROOM_00D947803 }}' | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
run: | | |
if [[ "${AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_MUSHROOM_00D947803}" != "" && \ | |
"${GITHUB_TOKEN}" != "" ]]; \ | |
then | |
echo "Secrets to deploy to azure were configured in the repo" | |
echo "azure=true" >> $GITHUB_OUTPUT | |
else | |
echo "Secrets to deploy to azure were not configured in the repo" | |
echo "azure=false" >> $GITHUB_OUTPUT | |
fi | |
build_and_deploy_job: | |
name: Build and Deploy Job | |
needs: check-secrets | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') && needs.check-secrets.outputs.azure == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch docs | |
run: | | |
make docs | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_MUSHROOM_00D947803 }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### | |
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig | |
app_location: "/" # App source code path | |
output_location: "build" # Built app content directory - optional | |
production_branch: "main" # So it knows that other branches/PRs should use preview environments that are removed on closure | |
###### End of Repository/Build Configurations ###### | |
close_pull_request_job: | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
name: Close Pull Request Job | |
steps: | |
- name: Close Pull Request | |
id: closepullrequest | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_POLITE_MUSHROOM_00D947803 }} | |
action: "close" |