Skip to content

Commit

Permalink
Merge pull request #39 from ryan4yin/action-pdf
Browse files Browse the repository at this point in the history
feat: generate pdf automatically
  • Loading branch information
ryan4yin authored Oct 4, 2023
2 parents 1d18061 + 41d3d14 commit 490afad
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Release PDF"
on:
push:
tags:
- "v*.*.*"

jobs:
generate-pdf:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install nix
uses: cachix/install-nix-action@v23
with:
nix_path: "nixpkgs=channel:nixpkgs-unstable"
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Show nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- name: Run a command with nix develop
run: |
nix develop --ignore-environment --command bash -c '
pnpm install
pnpm export-pdf
'
# - uses: actions/upload-artifact@v3
# with:
# name: pdf
# path: '*.pdf'
- name: Release PDF
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
nixos-and-flakes-book.pdf
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [ node2nix nodejs pnpm yarn ];
packages = with pkgs; [ node2nix nodejs pnpm yarn git];

shellHook = ''
echo "node `${pkgs.nodejs}/bin/node --version`"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs",
"export-pdf": "press-export-pdf export ./docs"
"export-pdf": "press-export-pdf export ./docs --outFile ./nixos-and-flakes-book.pdf"
},
"dependencies": {
"markdown-it-footnote": "^3.0.3",
Expand Down

0 comments on commit 490afad

Please sign in to comment.