Skip to content

Commit

Permalink
Defaults in yaml file (#17)
Browse files Browse the repository at this point in the history
* Pandoc defaults in a separate YAML file
* YAML index for each report
* Auto date on the report title page
* Template on submodule
* CI corrections, refactor defaults
* Readme badges
* One-side PDF content
  • Loading branch information
maldins46 committed Feb 18, 2021
1 parent d567193 commit 5a50a64
Show file tree
Hide file tree
Showing 32 changed files with 339 additions and 203 deletions.
65 changes: 60 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ name: CI

on:
push:
branches:
- main
- dev

pull_request:
branches:
- dev
- main
- 'release/**'
- 'hotfix/**'

jobs:
lint:
name: Lint
Lint:
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
Expand All @@ -28,5 +30,58 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Code lint
- name: Lint Markdown
run: ./gradlew spotlessCheck

Build:
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%d-%m-%Y')"

- name: Prepare environment
run: |
mkdir docs
- name: Generate PPS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/pps-report/latex.yaml -o docs/PPSReport.pdf -M date:${{steps.date.outputs.date}}

- name: Generate LSS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/lss-report/latex.yaml -o docs/LSSReport.pdf -M date:${{steps.date.outputs.date}}

- name: Generate appendix documents PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/appendix/latex.yaml -o docs/Appendix.pdf -M date:${{steps.date.outputs.date}}

- name: Generate PPS report HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/pps-report/html.yaml -o docs/PPSReport.html

- name: Generate LSS report HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/lss-report/html.yaml -o docs/LSSReport.html

- name: Generate Appendix documents HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/appendix/html.yaml -o docs/Appendix.html

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: reports-${{ steps.date.outputs.date }}
path: docs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'hotfix/**'

jobs:
prerelease:
Deploy:
name: Opt-in pre-release
if: contains(github.event.head_commit.message, '[prerelease]')
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -46,33 +46,33 @@ jobs:
release_name: ${{ env.RELEASE_VERSION }}
prerelease: true

- name: Prepare report generation
id: reports
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%d-%m-%Y')"

- name: Prepare environment
run: |
echo "::set-output name=PPS_REPORT_MERGED::$(printf '"%s" ' src/markdown/pps-report/*.md)"
echo "::set-output name=LSS_REPORT_MERGED::$(printf '"%s" ' src/markdown/lss-report/*.md)"
echo "::set-output name=APPENDIX_MERGED::$(printf '"%s" ' src/markdown/appendix/*.md)"
mkdir report
mkdir docs
- name: Generate PPS report
uses: docker://pandoc/latex:2.11.3.2
- name: Generate PPS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -F pandoc-crossref --output=report/PPSReport-${{ env.RELEASE_VERSION }}.pdf ${{ steps.reports.outputs.PPS_REPORT_MERGED }}
args: -d ./pandoc/pps-report/latex.yaml -o docs/PPSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate LSS report
uses: docker://pandoc/latex:2.11.3.2
- name: Generate LSS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -F pandoc-crossref --output=report/LSSReport-${{ env.RELEASE_VERSION }}.pdf ${{ steps.reports.outputs.LSS_REPORT_MERGED }}
args: -d ./pandoc/lss-report/latex.yaml -o docs/LSSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate appendix documents
uses: docker://pandoc/latex:2.11.3.2
- name: Generate appendix documents PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -F pandoc-crossref --output=report/Appendix-${{ env.RELEASE_VERSION }}.pdf ${{ steps.reports.outputs.APPENDIX_MERGED }}
args: -d ./pandoc/appendix/latex.yaml -o docs/Appendix-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Upload release assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create-release.outputs.id }}
assets_path: ./report
assets_path: ./docs
133 changes: 133 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Release

# Generates a new release, after a release/* branch is successfully
# merged into main. The tag name is inferred from the branch name.

on:
pull_request:
branches:
- main
types:
- closed

jobs:
Deploy:

# only merged pull requests must trigger this job
if: github.event.pull_request.merged == true

runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for hotfix branches)
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Add tag
run: |
git config user.name releaserbot
git config user.email github-actions@github.com
git tag ${{ env.RELEASE_VERSION }} -a -m "Release ${{ env.RELEASE_VERSION }}"
git push --follow-tags
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
prerelease: false

- name: Create "merge into dev" pull request
uses: thomaseizinger/create-pull-request@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: main
base: dev
title: Merge main into dev branch
body: |
This PR merges the main branch back into dev. This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates, are also present on the dev branch.
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%d-%m-%Y')"

- name: Prepare environment
run: |
mkdir docs
- name: Generate PPS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/pps-report/latex.yaml -o docs/PPSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate LSS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/lss-report/latex.yaml -o docs/LSSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate appendix documents PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/appendix/latex.yaml -o docs/Appendix-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Upload release assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create-release.outputs.id }}
assets_path: ./docs

- name: Checkout GitHub Pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: ./gh-pages

- name: Prepare gh-pages environment
run: |
rm -rf gh-pages/reports
mkdir gh-pages/reports -p
- name: Generate PPS report HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/pps-report/html.yaml -o ./gh-pages/reports/pps.html

- name: Generate LSS report HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/lss-report/html.yaml -o ./gh-pages/reports/lss.html

- name: Generate Appendix documents HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./pandoc/appendix/html.yaml -o ./gh-pages/reports/appendix.html

- name: Push reports to gh-pages
run: |
cd gh-pages
git config user.name Reportbot
git config user.email github-actions@github.com
git add reports
git commit -m "Update reports to version ${{ env.RELEASE_VERSION }}"
git push

0 comments on commit 5a50a64

Please sign in to comment.