reorder cmds and added types #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Developer Handbook | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.repository == 'JumpsecLabs/Developer.Handbook' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install pandoc | |
run: | | |
sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended pandoc -y | |
- name: Verify files | |
run: | | |
cd docs | |
ls -la ./ | |
for file in $(cat pandoc_order.txt); do | |
if [ ! -f "$file" ]; then | |
echo "File $file not found!" | |
exit 1 | |
fi | |
done | |
- name: Generate HTML from markdown | |
run: | | |
cd docs | |
pandoc -t html --include-before-body=./version.md -s -o developer_handbook.html --toc --number-sections --wrap=none $(cat pandoc_order.txt) | |
- name: Generate PDF from HTML | |
run: | | |
cd docs | |
pandoc developer_handbook.html -s --pdf-engine=pdflatex -o developer_handbook.pdf -t pdf -f html | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: developer-handbook | |
path: docs/developer_handbook.pdf | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.repository == 'JumpsecLabs/Developer.Handbook' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Extract version | |
id: extract_version | |
run: | | |
version=$(grep -oP 'Version: \K[0-9]+\.[0-9]+\.[0-9]+' docs/version.md) | |
echo "::set-output name=version::$version" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.extract_version.outputs.version }} | |
release_name: Release v${{ steps.extract_version.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: developer-handbook | |
path: ./ | |
- 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: ./developer_handbook.pdf | |
asset_name: developer_handbook.pdf | |
asset_content_type: application/pdf |