Files
spearhead/.github/workflows/docs.yml
T
2024-10-12 16:00:20 +02:00

68 lines
2.4 KiB
YAML

#start
name: update newsletters
on:
push:
branches:
- main
jobs:
buildandpush:
name: push_file
runs-on: ubuntu-latest
env:
branch: main
username: dutchie032
repo: dutchie032.github.io
sourcefileA: Reference
sourcefileB: GetStarted
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
with:
path: './spearhead'
- name: ls
run: ls
- name: Setup credentials to access private repositories
run: git config --global url.https://${{ secrets.API_TOKEN_GITHUB }}@github.com/.insteadOf https://github.com/
- name: Git Config
run: git config --global user.email "automated@action.com"
- name: Git Config
run: git config --global user.name "automated action"
- name: clone
run: git clone --single-branch --branch $branch https://github.com/$username/$repo
- name: ls
run: ls
- name: Replace string in file
run: |
import os
with open("./spearhead/config.lua", "r") as luaFile:
luaConfig = luaFile.read()
with open("./spearhead/_docs/Reference.md", "r+") as mdFile:
text = mdFile.read()
text = text.replace("##!config!##", luaConfig)
mdFile.write()
shell: python
- name: mkdir
run: mkdir -p ./$repo/Spearhead
- run: npm i markdown-to-html-cli -g
- run: markdown-to-html --title 'Spearhead' --dark-mode auto --keywords "dcs,spearhead,tdcs,mission,campaign,tactical dcs,tactical" --no-dark-mode --markdown-style-theme dark --source ./spearhead/_docs/$sourcefileA.md --output ./$repo/Spearhead/$sourcefileA.html
- run: markdown-to-html --title 'Spearhead' --dark-mode auto --keywords "dcs,spearhead,tdcs,mission,campaign,tactical dcs,tactical" --no-dark-mode --markdown-style-theme dark --source ./spearhead/_docs/$sourcefileB.md --output ./$repo/Spearhead/$sourcefileB.html
- run: python3 ./spearhead/SpearheadCompile.py "./spearhead" "./$repo/Spearhead/spearhead.lua"
- run: cp "./spearhead/config.lua" "./$repo/Spearhead/spearheadConfig.lua"
- run: cp -a ./spearhead/_docs/img/. ./$repo/Spearhead/img/
- name: ls
run: ls
working-directory: ./dutchie032.github.io
- name: add
run: git add --a
working-directory: ./dutchie032.github.io
- name: commit
run: git commit -a -m "Automatic Update of Spearhead README"
working-directory: ./dutchie032.github.io
- name: push
run: git push
working-directory: ./dutchie032.github.io