update overriden templates after hugo upgrade #631
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: | |
schedule: | |
- cron: '0 8 * * TUE' #MON|TUE|WED|THU|FRI|SAT|SUN | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
env: | |
IS_PRODUCTION: "${{ github.event_name != 'pull_request' }}" | |
PRODUCTION_URL: "https://blog.martdegraaf.nl/" | |
STAGING_URL: "${{ format('https://green-ocean-0187fc203-{0}.westeurope.2.azurestaticapps.net/', github.event.number) }}" | |
jobs: | |
build_and_deploy_job: | |
if: github.event_name == 'push' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.action != 'closed') | |
runs-on: ubuntu-latest | |
name: Build and Deploy Job | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
set-safe-directory: true | |
- name: "git set safe directory" | |
run: | | |
git config --global --add safe.directory '*' | |
# working-directory: "src/blog/" | |
- 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_GREEN_OCEAN_0187FC203 }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
app_build_command: "git config --global --add safe.directory '*' && npm run build" | |
###### 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: "src/blog" # App source code path | |
api_location: "" # Api source code path - optional | |
output_location: "public" # Built app content directory - optional | |
###### End of Repository/Build Configurations ###### | |
deployment_environment: "${{ env.IS_PRODUCTION == 'false' && 'staging' || '' }}" | |
env: | |
HUGO_ENVIRONMENT: "${{ env.IS_PRODUCTION == 'true' && 'production' || 'staging' }}" | |
HUGO_BASEURL: "${{ env.IS_PRODUCTION == 'true' && env.PRODUCTION_URL || env.STAGING_URL }}" | |
HUGO_BUILDDRAFTS: "${{ env.IS_PRODUCTION == 'false' }}" | |
HUGO_BUILDFUTURE: "${{ env.IS_PRODUCTION == 'false' }}" | |
test: | |
env: | |
working-directory: ./src/e2e | |
defaults: | |
run: | |
working-directory: ${{ env.working-directory }} | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
name: Test Stage | |
needs: build_and_deploy_job | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test | |
env: | |
PLAYWRIGHT_TEST_BASE_URL: "${{ env.IS_PRODUCTION == 'true' && env.PRODUCTION_URL || env.STAGING_URL }}" | |
PLAYWRIGHT_TESTS_PRODUCTION: ${{ env.IS_PRODUCTION == 'true'}} | |
PASSWORD: ${{ secrets.AZURE_STATIC_WEBAPP_PASSWORD }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
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_GREEN_OCEAN_0187FC203 }} | |
action: "close" |