Skip to content

Build PDF

Build PDF #82

Workflow file for this run

name: Build PDF
permissions: write-all
on:
# Manual Trigger
workflow_dispatch:
inputs:
release_notes:
description: 'Release notes for this PDF release'
required: true
default: 'No description provided on this release'
build_private:
type: boolean
description: 'Build privately & include sensitive data'
default: false
# Run pipeline every first day of the month
# schedule:
# - cron: '0 0 1 * *'
# # Run Pipeline on Manual Push
# push:
# branches:
# - main
jobs:
build_jekyll:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Fill sensitive data to markdown
if: ${{ github.event.inputs.build_private == 'true' }}
run: sed -i'.bak' 's/<div id="webaddress">/<div id="webaddress">\n<text>${{ secrets.CV_PHONE_NUMBER }}<\/text> | /' index.md
- name: Build Jekyll pages
uses: actions/[email protected]
with:
source: ./
destination: ./_site
- name: Publish pages to pipeline artifact
if: ${{ github.event.inputs.build_private == 'false' }}
uses: actions/upload-artifact@v3
with:
name: jekyll-published-page
path: ./_site
- name: Publish pages with sensitive data to pipeline artifact
if: ${{ github.event.inputs.build_private == 'true' }}
uses: actions/upload-artifact@v3
with:
name: jekyll-published-page
path: ./_site
retention-days: 2
publish_pdf:
runs-on: ubuntu-latest
needs: [build_jekyll]
steps:
- name: Setup Variables
run: |
cat <<EOF > release_notes.txt
## :spiral_notepad: Release notes
${{ github.event.inputs.release_notes }}
EOF
echo "PIPELINE_BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
echo "PIPELINE_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV
echo "PIPELINE_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Pull artifact from previous job
uses: actions/download-artifact@v3
with:
name: jekyll-published-page
path: ./_site
- name: Create PDF from artifact
uses: markwilson/[email protected]
with:
htmlPath: "./_site/index.html"
pdfName: "CV-${{ env.PIPELINE_DATE }}"
- name: Publish PDF result to artifact
if: ${{ github.event.inputs.build_private == 'true' }}
uses: actions/upload-artifact@v3
with:
name: "CV-${{ env.PIPELINE_DATE }}.pdf"
path: "${{ github.workspace }}/dist/CV-${{ env.PIPELINE_DATE }}.pdf"
retention-days: 2
- name: Publish PDF to GitHub release
if: ${{ github.event.inputs.build_private == 'false' }}
uses: softprops/action-gh-release@v1
with:
files: "${{ github.workspace }}/dist/CV-${{ env.PIPELINE_DATE }}.pdf"
fail_on_unmatched_files: true
name: "🚀 PDF Publish R.${{ env.PIPELINE_DATE }}"
tag_name: "PDF_${{ env.PIPELINE_DATE }}-${{ env.PIPELINE_TIMESTAMP }}"
body_path: release_notes.txt
body: "No description provided on this release"
target_commitish: "${{ env.PIPELINE_BRANCH_NAME }}"