78 lines
2.0 KiB
YAML
78 lines
2.0 KiB
YAML
name: Deploy to neocities
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
FORCE_COLOR: 1
|
|
node_version: lts/*
|
|
|
|
concurrency:
|
|
group: deploy-to-neocities
|
|
cancel-in-progress: true
|
|
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: create matrix
|
|
id: matrix
|
|
run: |
|
|
cd ${{ github.workspace }}
|
|
test=$(./compile.sh)
|
|
echo "matrix=$test" >> $GITHUB_OUTPUT
|
|
|
|
build:
|
|
needs: [ setup ]
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
value: ${{fromJSON(needs.setup.outputs.matrix)}}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
#- run: |
|
|
# cd ${{ github.workspace }}
|
|
# touch ${{ matrix.value.dest }}
|
|
- name: markdown to html
|
|
uses: jaywcjlove/markdown-to-html-cli@main
|
|
with:
|
|
source: ${{ matrix.value.source }}
|
|
output: ${{ matrix.value.dest }}
|
|
github-corners: https://github.com/jaywcjlove/markdown-to-html-cliA
|
|
|
|
deploy:
|
|
needs: [ setup, build ]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: npm i markdown-to-html-cli -g
|
|
- uses: actions/checkout@v4
|
|
- name: finish posts.html
|
|
env:
|
|
genhtml: ${{ needs.setup.outputs.genhtml }}
|
|
run: |
|
|
cd ${{github.workspace}}
|
|
./genhtml.sh > public/posts.html
|
|
- run: |
|
|
cd ${{github.workspace}}
|
|
for entry in notes/*
|
|
do
|
|
filename=$(basename "$entry" .md)
|
|
timestamp=`git log --format=%ad --date=format:'%Y-%m-%d' -- $entry`
|
|
dest="public/posts/$timestamp"
|
|
dest+="_$filename"
|
|
dest+=".html"
|
|
markdown-to-html --source $entry --output $dest
|
|
done
|
|
- name: Deploy to neocities
|
|
uses: bcomnes/deploy-to-neocities@v1
|
|
with:
|
|
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
|
|
cleanup: true
|
|
dist_dir: public
|
|
protected_files: 'dropbox/*'
|