Skip to content

Build Ebooks

Build Ebooks #6

Workflow file for this run

name: Build Ebooks
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
version:
description: 'Version?'
required: true
default: '4.x'
jobs:
build:
if: github.actor == 'kingthorin' || github.actor == 'ThunderSon' || github.actor == 'rejahrehim' || github.actor == 'victoriadrake'
name: Build
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Setup Action
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: SetUp python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt update
sudo apt install libgbm1
npm install -g md-to-pdf
sudo snap install pdftk
sudo apt install pandoc
- name: Get Tag Version
if: github.event_name == 'push'
id: vars
run: echo "tag=$(echo ${GITHUB_REF:10})" >> $GITHUB_OUTPUT
- name: Run Push Build
if: github.event_name == 'push'
run: |
npm run-script pdfgen -- ${{ steps.vars.outputs.tag }}
npm run-script epubgen -- ${{ steps.vars.outputs.tag }}
- name: Run Workflow Build
if: github.event_name == 'workflow_dispatch'
run: |
npm run-script pdfgen -- ${{ github.event.inputs.version }}
npm run-script epubgen -- ${{ github.event.inputs.version }}
- name: Create Release
if: github.event_name == 'push'
id: create_release
uses: ncipollo/[email protected]
with:
name: Release ${{ steps.vars.outputs.tag }}
artifacts: "./build/wstg-${{ steps.vars.outputs.tag }}.pdf, ./build/wstg-${{ steps.vars.outputs.tag }}.epub"
artifactContentType: application/pdf
artifactErrorsFailBuild: true
draft: false
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attach PDF and Epub
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: wstg-${{ github.event.inputs.version }}-ebooks
path: |
./build/wstg-${{ github.event.inputs.version }}.pdf
./build/wstg-${{ github.event.inputs.version }}.epub