mirror of
https://github.com/dwmkerr/hacker-laws.git
synced 2025-12-17 12:45:20 +01:00
build: version number and date in e-book
This commit is contained in:
7
.github/workflows/build-on-pull-request.yaml
vendored
7
.github/workflows/build-on-pull-request.yaml
vendored
@@ -14,9 +14,14 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Set a descriptive version. For PRs it'll be the short sha.
|
||||||
|
- name: Set Version
|
||||||
|
id: set_version
|
||||||
|
run: echo ::set-output name=VERSION::$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
# Prepare the content files.
|
# Prepare the content files.
|
||||||
- name: Prepare Content
|
- name: Prepare Content
|
||||||
run: ./scripts/prepare-markdown-for-ebook.sh
|
run: ./scripts/prepare-markdown-for-ebook.sh ${{ steps.set_version.outputs.VERSION }}
|
||||||
|
|
||||||
# Create a PDF from the prepared markdown.
|
# Create a PDF from the prepared markdown.
|
||||||
- name: Prepare PDF
|
- name: Prepare PDF
|
||||||
|
|||||||
7
.github/workflows/release-on-tag.yaml
vendored
7
.github/workflows/release-on-tag.yaml
vendored
@@ -14,9 +14,14 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Set a descriptive version. For PRs it'll be the short sha.
|
||||||
|
- name: Set Version
|
||||||
|
id: set_version
|
||||||
|
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||||
|
|
||||||
# Prepare the content files.
|
# Prepare the content files.
|
||||||
- name: Prepare Content
|
- name: Prepare Content
|
||||||
run: ./scripts/prepare-markdown-for-ebook.sh
|
run: ./scripts/prepare-markdown-for-ebook.sh ${{ steps.set_version.outputs.VERSION }}
|
||||||
|
|
||||||
# Create a PDF from the prepared markdown.
|
# Create a PDF from the prepared markdown.
|
||||||
- name: Prepare PDF
|
- name: Prepare PDF
|
||||||
|
|||||||
@@ -2,12 +2,21 @@
|
|||||||
# This script prepares a `hacker-laws.md` file which is in a format ready to be
|
# This script prepares a `hacker-laws.md` file which is in a format ready to be
|
||||||
# exported to PDF or other formats for an e-book.
|
# exported to PDF or other formats for an e-book.
|
||||||
|
|
||||||
|
# Require that we provide the version number and get a date.
|
||||||
|
version=$1
|
||||||
|
date=$(date "+%Y-%m-%d")
|
||||||
|
|
||||||
|
if [ -z $version ]; then
|
||||||
|
echo "version must be specified: ./prepare-markdown-for-ebook.sh <version>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the frontmatter.
|
# Create the frontmatter.
|
||||||
cat << EOF > frontmatter.md
|
cat << EOF > frontmatter.md
|
||||||
---
|
---
|
||||||
title: "Hacker Laws"
|
title: "Hacker Laws"
|
||||||
author: "Dave Kerr, github.com/dwmkerr/hacker-laws"
|
author: "Dave Kerr, github.com/dwmkerr/hacker-laws"
|
||||||
subtitle: "Laws, Theories, Principles and Patterns that developers will find useful."
|
subtitle: "Laws, Theories, Principles and Patterns that developers will find useful. ${version}, ${date}."
|
||||||
---
|
---
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user