Skip to content

fix for order of MASWE page #43

fix for order of MASWE page

fix for order of MASWE page #43

Workflow file for this run

name: Release docs
# checks are only on the draft directory because the release directory will be overwritten
on:
push:
# tagged x.x.x releases as well as release candidates
tags:
- ?.?.?*
workflow_dispatch:
env:
RESOURCE_PATH: release/assets/images:release/assets:release:assets/images:assets/images/logos:assets/images/logos/publish
# for security reasons the github actions are pinned to specific release versions
jobs:
link_checker:
name: Link checker
runs-on: ubuntu-24.04
steps:
- name: Checkout markdown
uses: actions/checkout@v4.2.0
- name: Link Checker
uses: lycheeverse/lychee-action@v2.1.0
with:
# skip the jekyll files under '_includes' directory, check only draft where the promotion comes from
args: >-
--no-progress
--max-retries 5
--exclude-path './_includes/*.html'
'./draft/**/*.md'
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
md_linter:
name: Lint markdown
runs-on: ubuntu-24.04
steps:
- name: Checkout markdown
uses: actions/checkout@v4.2.0
- name: Lint markdown
uses: DavidAnson/markdownlint-cli2-action@v18.0.0
with:
config: '.markdownlint.yaml'
globs: 'draft/**/*.md'
# only check the draft directory, that is where the promotion comes from
spell_checker:
name: Check spelling
runs-on: ubuntu-24.04
steps:
- name: Checkout markdown
uses: actions/checkout@v4.2.0
- name: spell_checker
uses: rojopolis/spellcheck-github-actions@0.45.0
create_artifacts:
name: Create artifacts
runs-on: ubuntu-24.04
needs: [link_checker, md_linter, spell_checker]
steps:
- name: Checkout markdown
uses: actions/checkout@v4.2.0
- name: Combine markdown
run: |
mkdir publish
mkdir assets/images/logos/publish
mkdir release/temp
tail --lines=+14 -q $(find draft -name "*[0-9]*.md" | sort) > release/temp/draft.markdown
- name: Fix up markdown
run: |
echo "GITHUB_WORKFLOW: ${GITHUB_WORKFLOW}"
echo "GITHUB_REF_NAME: ${GITHUB_REF_NAME}"
sed -i "s/{: .image-right }/{height=180px}/g" release/temp/draft.markdown
sed -i "s/{: .image-right-small }/{height=26px}/g" release/temp/draft.markdown
echo "rename draft to release"
sed -i "s|permalink: /draft/|permalink: /release/|g" release/temp/draft.markdown
sed -i "s/.*the latest contributions to the Developer Guide.*/\#\#\# Release version $GITHUB_REF_NAME/" release/temp/draft.markdown
sed -i "s/ (Draft)//gI" release/temp/draft.markdown
echo "remove contributing footer"
sed -i "/The OWASP Developer Guide is a community effort/d" release/temp/draft.markdown
sed -i "/edit on GitHub/d" release/temp/draft.markdown
sed -i "/www-project-developer-guide\/issues\/new?labels/d" release/temp/draft.markdown
sed -i "/www-project-developer-guide\/blob\/main/d" release/temp/draft.markdown
- name: Export to pdf
uses: docker://pandoc/latex:3.1
with:
args: >-
--from=markdown
--output=publish/OWASP_Developer_Guide.pdf
--resource-path=${{ env.RESOURCE_PATH }}
-fmarkdown-implicit_figures
release/title.pdf.yaml
release/temp/draft.markdown
- name: Export to epub
uses: docker://pandoc/latex:3.1
with:
args: >-
--from=markdown
--output=publish/OWASP_Developer_Guide.epub
--resource-path=${{ env.RESOURCE_PATH }}
-fmarkdown-implicit_figures
release/title.yaml
release/temp/draft.markdown
- name: Store pdf and epub assets
uses: actions/upload-artifact@v4.4.0
with:
name: export-docs
path: publish
create_release:
name: Create pull request
runs-on: ubuntu-24.04
needs: create_artifacts
steps:
- name: Checkout markdown
uses: actions/checkout@v4.2.0
- name: Promote draft to release
run: |
cd draft && find . -name "*.md" ! -name "info.md" -exec cp '{}' '../release/{}' \;
- name: Fix up markdown
run: |
echo "rename draft to release"
find release -name "*.md" -exec sed -i "s|permalink: /draft/|permalink: /release/|" {} +
find release -name "*.md" -exec \
sed -i "s/.*the latest contributions to the Developer Guide.*/\#\#\# Release version $GITHUB_REF_NAME/" {} +
find release -name "*.md" -exec sed -i "s/ (Draft)//gI" {} +
echo "revise page ordering"
find release -name "*.md" -exec sed -i "/order: / s/$/0/" {} +
echo "remove newpage tags"
find release -name "*.md" -exec sed -i '/newpage/d' {} +
echo "remove any multiple blank lines"
find release -name "*.md" -exec sed -i ':a; /^\n*$/{ s/\n//; N; ba};' {} +
find release -name "*.md" -exec sed -i '${/^$/d;}' {} +
- name: Fix up ToC sidebar
run: |
cp _data/draft.yaml _data/release.yaml
sed -i "s/^docs_list_title.*/docs_list_title: Developer Guide/" _data/release.yaml
- name: Retrieve pdfs and epubs
uses: actions/download-artifact@v4.1.7
with:
name: export-docs
- name: Update pdf and epub assets
run: |
cp OWASP_Developer_Guide.pdf assets/exports/.
cp OWASP_Developer_Guide.epub assets/exports/.
- name: Create release
if: ${{ ! contains( github.ref_name, 'RC' ) }}
uses: peter-evans/create-pull-request@v7.0.1
with:
title: |
Release ${{ github.ref_name }} of Developer Guide
body: |
**Summary** :
Automatically generated pull-request for the latest release version
**Description for the changelog** :
release of version ${{ github.ref_name }}
**Other info** :
Please verify and then update the release by merging the pull request
commit-message: update to release version ${{ github.ref_name }}
branch: update-release
base: main
labels: release
draft: false
- name: Create release candidate
if: ${{ contains(github.ref_name, 'RC') }}
uses: peter-evans/create-pull-request@v7.0.1
with:
title: |
Developer Guide release candidate ${{ github.ref_name }}
body: |
**Summary** :
Automatically generated pull-request for release candidate version ${{ github.ref_name }}
**Description for the changelog** :
release candidate version ${{ github.ref_name }}
**Other info** :
This PR should not be merged as it provides the _proposed_ changes for the next release
commit-message: release candidate version ${{ github.ref_name }}
branch: pre-release
base: main
labels: pre-release
draft: false