Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use official Github Pages action #81

Merged
merged 5 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@ nix run nixpkgs#nodePackages.live-server -- ./result
## GitHub Pages

GitHub Actions CI is responsible for deploying to GitHub Pages. See `.github/workflows/publish.yaml`.

See also: [Tips on setting up GitHub pages action](https://github.com/srid/emanote/discussions/507)

38 changes: 28 additions & 10 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,41 @@ on:
push:
branches:
- master
- gh-action

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
emanote:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.garnix.io?priority=41 https://cache.nixos.org/
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Build the website (Nix) 🔧
run: |
nix build -j 4
- name: Deploy to gh-pages 🚀
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./result/
# cname: yoursite.com
nix build -o ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
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
4 changes: 3 additions & 1 deletion GitHub Pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
slug: github-pages
---

[GitHub Pages](https://pages.github.com/) is an easy way to deploy and host static websites on GitHub.
[GitHub Pages](https://pages.github.com/) is an easy way to deploy and host static websites on GitHub.

See [our CI configuration](https://github.com/srid/emanote-template/blob/master/.github/workflows/publish.yaml).