Merge pull request #42 from social-science-data-editors/lars-2023 #79
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
# This is a basic workflow to help you get started with Actions | |
name: Pre-process files | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: | |
- development | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a job called "build" | |
convert_docs: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[noaction]')" | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Update ubuntu | |
run: sudo apt-get update | |
- name: install wkhtml | |
run: sudo apt-get install wkhtmltopdf xvfb | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Create directory | |
run: "[[ -d templates ]] || mkdir templates " | |
- name: Create temp directory | |
run: "[[ -d temp ]] || mkdir temp " | |
- name: Fix webroot | |
run: _scripts/set_webroot.sh template-README.md _README.md | |
# Runs a set of commands using the runners shell | |
- name: Run docker for HTML | |
uses: docker://pandoc/latex:2.9 | |
with: | |
args: "_README.md --standalone -t html5 -o templates/README.html --metadata pagetitle=README --lua-filter=_scripts/links-to-html.lua" | |
- name: Convert HTML to PDF | |
run: "/usr/bin/xvfb-run /usr/bin/wkhtmltopdf templates/README.html templates/README.pdf" | |
# Runs a single command using the runners shell | |
- name: Remove temp directory | |
run: "rm -rf temp " | |
# Convert to other formats | |
- name: Run docker for Docx | |
uses: docker://pandoc/latex:2.9 | |
with: | |
args: "_README.md --standalone -t docx -o templates/README.docx --lua-filter=_scripts/links-to-html.lua" | |
- name: Run docker for latex | |
uses: docker://pandoc/latex:2.9 | |
with: | |
args: "_README.md --standalone -t latex --template=default.latex -o templates/README.tex --lua-filter=_scripts/links-to-html.lua" | |
- name: Set up git config | |
run: | | |
# setup the username and email. | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Add and remove files | |
run: | | |
cp template-README.md templates/README.md | |
git add templates/README.* | |
git commit -m "Adding derived files" | |
git checkout -b release-candidate | |
git push origin release-candidate --force | |