Merge branch 'main' of https://github.com/RoboKiwi/RoboKiwi.com #91
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: | |
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: Build and Deploy Job | |
env: | |
SITE_PATH: ./RoboKiwi.com | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Install SiteGen tool | |
id: setup-sitegen | |
run: | | |
dotnet new tool-manifest | |
dotnet tool install --local SiteGen.Cli --version 0.1.7-alpha | |
- name: Install Pygments | |
id: setup-pygments | |
run: | | |
pip install pygments | |
- name: Build site | |
id: build-site | |
run: | | |
dotnet build "${{ env.SITE_PATH }}/RoboKiwi.com.csproj" | |
sudo apt-get install tree | |
tree "${{ env.SITE_PATH }}" | |
- name: NPM build | |
id: build-npm | |
run: | | |
cd "${{ env.SITE_PATH }}" | |
npm install | |
npm run build | |
- name: Run SiteGen | |
id: run-sitegen | |
run: | | |
cd "${{ env.SITE_PATH }}" | |
dotnet run & | |
sleep 20 | |
dotnet sitegen | |
- name: Listing | |
id: run-tree | |
run: | | |
tree "/home/runner/work/RoboKiwi.com/RoboKiwi.com" | |
- name: Build And Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
env: | |
HUGO_VERSION: 0.92.0 | |
HUGO_HMAC_SECRET: ${{ secrets.HUGO_HMAC_SECRET }} | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_YELLOW_MEADOW_0F59B3E1E }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
skip_app_build: true | |
app_location: "/github/workspace/RoboKiwi.com/public" | |
api_location: "/api" # Api source code path - optional | |
output_location: '/public' # Built app content directory - optional | |
app_build_command: 'dotnet sitegen' | |
###### 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_YELLOW_MEADOW_0F59B3E1E }} | |
action: "close" |