mirror of
https://github.com/dwmkerr/hacker-laws.git
synced 2025-12-18 13:14:55 +01:00
build: release ebook when version tag is pushed
This commit is contained in:
38
.github/workflows/build-on-pull-request.yaml
vendored
Normal file
38
.github/workflows/build-on-pull-request.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# This pipeline builds the PDF ebook on any pull request to master.
|
||||
name: "Build PDF"
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
prepare-pdf:
|
||||
# Focal Fossa. Please don't use 'latest' tags, it's an anti-pattern.
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
# Checkout the code.
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Prepare the content files.
|
||||
- name: Prepare Content
|
||||
run: ./scripts/prepare-markdown-for-ebook.sh
|
||||
|
||||
# Create a PDF from the prepared markdown.
|
||||
- name: Prepare PDF
|
||||
uses: docker://pandoc/latex:2.9
|
||||
with:
|
||||
args: "-V toc-title:\"Table Of Contents\" --toc --pdf-engine=pdflatex --standalone --output hacker-laws.pdf hacker-laws.md"
|
||||
|
||||
# Publish the PDF and intermediate markdown as an artifact.
|
||||
- name: Publish PDF Artifact
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: hacker-laws.pdf
|
||||
path: hacker-laws.pdf
|
||||
|
||||
- name: Publish Intermiediate Markdown Artifact
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: hacker-laws.md
|
||||
path: hacker-laws.md
|
||||
64
.github/workflows/release-on-tag.yaml
vendored
Normal file
64
.github/workflows/release-on-tag.yaml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# This pipeline builds the PDF ebook on any tag starting with 'v'.
|
||||
name: "Create Release"
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
prepare-pdf:
|
||||
# Focal Fossa. Please don't use 'latest' tags, it's an anti-pattern.
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
# Checkout the code.
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Prepare the content files.
|
||||
- name: Prepare Content
|
||||
run: ./scripts/prepare-markdown-for-ebook.sh
|
||||
|
||||
# Create a PDF from the prepared markdown.
|
||||
- name: Prepare PDF
|
||||
uses: docker://pandoc/latex:2.9
|
||||
with:
|
||||
args: "-V toc-title:\"Table Of Contents\" --toc --pdf-engine=pdflatex --standalone --output hacker-laws.pdf hacker-laws.md"
|
||||
|
||||
# Publish the PDF artifact.
|
||||
- name: Publish PDF Artifacts
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: hacker-laws.pdf
|
||||
path: hacker-laws.pdf
|
||||
|
||||
release:
|
||||
needs: prepare-pdf
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: hacker-laws.pdf
|
||||
|
||||
- name: Create Release
|
||||
id: create-release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
body: |
|
||||
Hacker Laws E-Book
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
||||
asset_path: ./hacker-laws.pdf
|
||||
asset_name: hacker-laws.pdf
|
||||
asset_content_type: application/pdf
|
||||
Reference in New Issue
Block a user