AnnemarieWittig is generating a README in Markdown. #63
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: GitHub Actions Asciidoc Transfer | |
run-name: ${{ github.actor }} is generating a README in Markdown. | |
on: [push] | |
jobs: | |
generate_readme: | |
name: Create Markdown Readme | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: sudo apt-get update | |
- run: sudo apt-get install asciidoc pandoc | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- name: Remove characters / phrases that cannot be interpreted in the asciidoc - markdown conversion | |
run: | | |
sed -i "s/\[.lead\]/ /g" ./README.adoc | |
sed -i "s/>/ /g" ./README.adoc | |
- name: Start ASCIIDOC conversion | |
run: | | |
asciidoc -b docbook README.adoc | |
cat ./README.xml | |
pandoc -f docbook -t markdown_strict ./README.xml -o ./README.md | |
sed -i '1i# Automation Service \n' README.md | |
mv README.md AutomationService | |
- name: Upload generated Readme for job 1 generate_readme | |
uses: actions/upload-artifact@v3 | |
with: | |
name: readme | |
path: AutomationService/README.md | |
push_readme: | |
name: Push new Readme | |
needs: generate_readme | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download readme result from job 1 generate_readme | |
uses: actions/download-artifact@v3 | |
with: | |
name: readme | |
- name: move README to correct position | |
run: mv README.md AutomationService/ | |
- name: Commit and Push file | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git status | |
if [[ -n $(git diff AutomationService/README.md) ]]; then | |
git add AutomationService/README.md | |
git commit -m "Actions Generated Readme" | |
git push | |
else | |
echo "README is the same. Nothing to commit." | |
fi |