name: Website on: push: branches: - master - main paths: - 'website/**' - 'assets/**' pull_request: types: [opened, synchronize, ready_for_review, reopened] paths: - 'website/**' - 'assets/**' permissions: contents: read pages: write id-token: write concurrency: group: "website" cancel-in-progress: false defaults: run: shell: bash jobs: update-date: name: Auto update dates runs-on: ubuntu-latest if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') steps: - uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16 with: diagnostic-endpoint: "" - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Check for changes run: | IS_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -Ec "^website*" || :) [[ $IS_CHANGED -gt 0 ]] && echo "IS_CHANGED=true" >> $GITHUB_ENV || echo "IS_CHANGED=false" >> $GITHUB_ENV - name: Update last modified date in modified docs if: env.IS_CHANGED == 'true' run: | git diff --name-only --diff-filter=d ${{ github.event.before }} ${{ github.sha }} | grep -E "^website*" \ | sed -e 's/\(.*\)/"\1"/' | xargs sed -i "/date:/c\date: $(date +'%Y-%m-%d')" - name: Create Pull Request uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v6 if: env.IS_CHANGED == 'true' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') with: commit-message: Auto-updated docs branch: docs-generator title: Auto-generated docs update body: | Auto generated docs from master commit ${{ github.sha }} website-generate: name: Auto generate website runs-on: ubuntu-latest if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') steps: - uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16 with: diagnostic-endpoint: "" - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: nix checks run: nix flake check - name: nix build env: HUGO_ENVIRONMENT: production HUGO_ENV: production run: nix build .#website - name: Setup Pages id: pages uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 - name: Upload artifact uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 with: path: ./result website-deploy: name: Deploy website if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: website-generate steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4