Skip to content

chore: switch comment location to make more sense #321

chore: switch comment location to make more sense

chore: switch comment location to make more sense #321

Workflow file for this run

---
name: build self-contained READMEs
"on":
push:
branches-ignore:
- renovate/**
permissions:
contents: read
# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is triggered for it
concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true
jobs:
gh-pages:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: "${{ steps.deployment.outputs.page_url }}"
steps:
### Setup
- name: check out the codebase
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7.0"
- name: set up python 3
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: "3.x"
- name: setup/activate pre-commit cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
with:
path: ~/.cache/pre-commit
key: "${{ hashFiles('.pre-commit-config.yaml') }}"
- name: install asciidoctor and other relevant ruby gems
run: gem install --no-document asciidoctor asciidoctor-reducer rouge coderay
- name: get first line of commit message as variable
shell: bash
run: |
echo "FIRST_LINE_OF_HEAD_COMMIT_MESSAGE=${HEAD_COMMIT_MESSAGE}" | head -1 >> $GITHUB_ENV
env:
HEAD_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
### README.orig.adoc & co.
- name: Generate README.adoc using ascidoctor-reducer.
run: asciidoctor-reducer README.orig.adoc -o README.adoc
- name: generate README.xml from README.adoc using ascidoctor
run: asciidoctor -b docbook README.adoc
- name: Generate README.md from README.xml using pandoc
uses: docker://pandoc/core@sha256:d2c4aa0c26e9480b8ab15eb952f49cb6c33ca5635417e1bb064e715a5a32a9e9
with:
args: "-f docbook -t markdown_strict README.xml -o README.md --wrap=none"
### SECURITY.adoc
- name: generate SECURITY.xml from SECURITY.adoc using ascidoctor
run: asciidoctor -b docbook SECURITY.adoc
- name: Generate SECURITY.md from SECURITY.xml using pandoc
uses: docker://pandoc/core:3.1@sha256:222badaf55d35aa19a54294721b2669a55737e8a96e78f038b89c2b70bccd13f
with:
args: "-f docbook -t markdown_strict SECURITY.xml -o SECURITY.md --wrap=none"
### Commit
- name: add 'changes will be lost' comment to generated files
run: |
sed -i \
'1s|^|This file is being generated by .github/workflows/gh-pages.yml - all local changes will be lost eventually!\n|' \
README.adoc README.md SECURITY.md
sed -i '1s|\(.*\)|<!-- \1 -->|' README.md SECURITY.md
sed -i '1s|\(.*\)|// \1|' README.adoc
- name: pre-commit generated .md files
run: |
python3 -m pip install pre-commit
pre-commit run --files README.md SECURITY.md || true
pre-commit run --files README.md SECURITY.md || true
- name: Commit generated files.
uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80 # tag=v4
with:
commit_message: "${{ env.FIRST_LINE_OF_HEAD_COMMIT_MESSAGE }}\n${{ github.sha }}"
file_pattern: README.adoc README.md SECURITY.md
disable_globbing: true
### Deploy README.adoc
- name: Generate HTML
run: asciidoctor --backend=html5 --destination-dir docs --out-file index.html README.adoc
if: github.ref == 'refs/heads/master'
- name: Setup Pages
uses: actions/configure-pages@b8130d9ab958b325bbde9786d62f2c97a9885a0e # v3
if: github.ref == 'refs/heads/master'
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2
with:
path: "./docs/"
if: github.ref == 'refs/heads/master'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@de14547edc9944350dc0481aa5b7afb08e75f254 # v2
if: github.ref == 'refs/heads/master'