gha challenge - ls-R; artifact upload directory #64
Workflow file for this run
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 document | |
on: [ push, create ] | |
env: | |
DOC_BASE: ./ | |
RELEASE_VERSION: ${GITHUB_REF#refs/*/} | |
DOWNLOAD_URL_BASE: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download | |
jobs: | |
make-document: | |
name: Compile document | |
runs-on: ubuntu-latest | |
container: | |
image: k4zuki/pandocker-alpine:2.19 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup safe directory for git | |
run: | | |
repo=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/} | |
git config --global --add safe.directory /__w/${repo}/${repo} | |
- name: Update dependencies | |
run: | | |
pip3 install pandocker-lua-filters docx-coreprop-writer | |
pip3 install git+https://github.com/k4zuki/[email protected] | |
- name: Prepare QR code for this build (at a tag) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
run: | | |
pip3 install qrcode | |
make initdir html | |
TARGET=`ls ${{env.DOC_BASE}}/Out/*.html` | |
TARGET=${TARGET#${{env.DOC_BASE}}/Out} | |
qr ${{env.DOWNLOAD_URL_BASE}}/${{env.RELEASE_VERSION}}/${TARGET//.html/}.pdf > ${{env.DOC_BASE}}/images/QRcode.png | |
- name: Build document | |
run: | | |
make initdir html docx | |
- name: Upload artifact files (at a push) | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ env.DOC_BASE }}/Out | |
docx2pdf: | |
name: Docx to PDF conversion and release | |
runs-on: windows-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Wait for artifact build | |
uses: yogeshlonkar/wait-for-jobs@v0 | |
with: | |
jobs: "Compile document" | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v3 | |
- name: ls | |
run: ls -R | |
- name: Install Office | |
run: choco install office365business # This takes about 5min | |
- name: docx2pdf | |
run: | | |
cd artifact | |
../docx2pdf/docx2pdf.ps1 | |
- name: Make a release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
artifact/*.docx | |
artifact/*.html | |
artifact/*.pdf |