Skip to content

Add new example VCR scripts and corresponding SVG assets for CLI documentation #61

Add new example VCR scripts and corresponding SVG assets for CLI documentation

Add new example VCR scripts and corresponding SVG assets for CLI documentation #61

name: Build and publish to GitHub Pages
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "main" ]
env:
ASPNETCORE_ENVIRONMENT: Production
WEBAPP_PATH: ./Spectre.Docs/
WEBAPP_CSPROJ: Spectre.Docs.csproj
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Build the Project
run: |
dotnet build
- name: Run webapp and generate static files
run: |
dotnet run --project ${{ env.WEBAPP_PATH }}${{env.WEBAPP_CSPROJ}} --configuration Release -- build
- name: Install minify
run: |
curl -sfL https://github.com/tdewolff/minify/releases/latest/download/minify_linux_amd64.tar.gz | tar -xzf - -C /tmp
sudo mv /tmp/minify /usr/local/bin/
- name: Minify CSS and JavaScript files
run: |
# Find and minify all CSS files
find "${{ env.WEBAPP_PATH }}output" -type f -name "*.css" | while read cssfile; do
/usr/local/bin/minify -o "$cssfile" "$cssfile"
echo "Minified $cssfile"
done
# Find and minify all JavaScript files
find "${{ env.WEBAPP_PATH }}output" -type f -name "*.js" | while read jsfile; do
/usr/local/bin/minify -o "$jsfile" "$jsfile"
echo "Minified $jsfile"
done
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Add .nojekyll file
run: touch ${{ env.WEBAPP_PATH }}output/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.WEBAPP_PATH }}output
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true)
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4