Skip to content

Commit

Permalink
Create hugo_azure.yml
Browse files Browse the repository at this point in the history
trying new yaml found online.
microsoft/Oryx#2078
  • Loading branch information
ljrain committed Nov 19, 2023
1 parent ff36b6f commit 05d8fe3
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/hugo_azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Initialize job
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

### Using alt build process
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true

- name: Cache Hugo modules
uses: actions/cache@v3
with:
path: public
key: ${{ runner.os }}-hugo-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugo-
- name: Build site with Hugo
run: hugo --minify --cleanDestinationDir

### Oryx is buggy bypassing the build step for now
- name: Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_sanitized }}
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: "public" # App source code path
api_location: "" # Api source code path - optional
output_location: "public" # Built app content directory - optional
skip_app_build: "true"
skip_api_build: "true"
###### 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_sanatized }}
action: "close"

0 comments on commit 05d8fe3

Please sign in to comment.