Update and deploy #948
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: Update and deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths-ignore: | |
- README.md | |
schedule: | |
- cron: "00 1 * * *" | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
deploy: | |
environment: azure | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: "Az login" | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
allow-no-subscriptions: true | |
enable-AzPSSession: true | |
- name: "Get all Policy Aliases" | |
uses: azure/powershell@v2 | |
with: | |
inlineScript: | | |
./src/ps1/Get-AzResourcePolicyAliases.ps1 | |
azPSVersion: "latest" | |
- name: "List generated contents" | |
run: | | |
ls content | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: "0.128.2" | |
extended: true | |
- name: Build Hugo site | |
run: | | |
hugo | |
find ./public -name "*.html" -print0 | xargs -0 sed -i '/^ *$/d' | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/[email protected] | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
cname: policyalias.mats.codes | |
commit_message: "docs: update and publish (${{ github.event_name }})" | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' |