2023-10-04 09:17:37 +02:00
|
|
|
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: |
|
2024-02-27 02:45:08 +01:00
|
|
|
nix develop .#export-pdf --ignore-environment --command bash -c '
|
2023-10-04 09:17:37 +02:00
|
|
|
pnpm install
|
|
|
|
pnpm export-pdf
|
|
|
|
'
|
2023-10-12 18:44:15 +02:00
|
|
|
# # For debugging, upload the pdfs as artifacts
|
2023-10-04 09:17:37 +02:00
|
|
|
# - uses: actions/upload-artifact@v3
|
|
|
|
# with:
|
|
|
|
# name: pdf
|
|
|
|
# path: '*.pdf'
|
2023-10-12 18:44:15 +02:00
|
|
|
- name: Generate changelog
|
|
|
|
run: |
|
|
|
|
# Get the previous tag
|
|
|
|
git fetch --tags
|
|
|
|
PREVIOUS_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
|
|
|
|
# Generate the changelog
|
|
|
|
git log --pretty=format:"%h %s" $PREVIOUS_TAG..HEAD > CHANGELOG
|
|
|
|
|
|
|
|
echo "Changelog from $PREVIOUS_TAG to HEAD:"
|
|
|
|
cat CHANGELOG
|
2023-10-04 09:17:37 +02:00
|
|
|
- name: Release PDF
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
2023-10-12 18:44:15 +02:00
|
|
|
generate_release_notes: true
|
|
|
|
body_path: CHANGELOG
|
2023-10-04 09:17:37 +02:00
|
|
|
files: |
|
|
|
|
nixos-and-flakes-book.pdf
|