Skip to content

Build and Deploy

Build and Deploy #89

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
inputs:
force:
description: 'Set to "true" to mark this run as forced when manually triggered'
required: false
default: "false"
jobs:
build:
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout computorg.github.io site
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
- name: Setup Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Setup .NET
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force == 'true' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Install Computo CLI tools
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force == 'true' }}
env:
API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}
run: |
dotnet nuget add source "https://nuget.pkg.github.com/computorg/index.json" \
--name "GitHubPackages" \
--username "fradav" \
--password "$API_GITHUB_TOKEN" \
--store-password-in-clear-text
dotnet tool install --global Computo.PublicationUpdater.Cli
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: refresh publications and commit changes
if: ${{ github.event_name == 'workflow_dispatch' || github.event.inputs.force == 'true' }}
env:
API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}
run: |
computo-publish .
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add site/published.{yml,xml} site/pipeline.yml site/mock-papers.yml || true
if git diff --staged --quiet; then
echo "No publication changes to commit"
else
git commit -m "Refresh publication metadata [skip ci]"
git push origin HEAD:${{ github.ref_name }}
fi
- name: Build site
run: quarto render
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
deploy:
if: github.event_name != 'pull_request'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}