Compare commits

...

10 commits

11 changed files with 69 additions and 64 deletions

View file

@ -11,13 +11,15 @@ RUN go mod download && CGO_ENABLED=0 GOOS=linux go build -o /md2gmi
FROM ubuntu:22.04 AS release
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y uuid-runtime=2.37.2-4ubuntu3.4 \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
dos2unix=7.4.2-2 \
uuid-runtime=2.37.2-4ubuntu3.4 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=go-builder /md2gmi /usr/local/bin/md2gmi
COPY convert-dir.sh /usr/local/bin/convert-dir.sh
RUN chmod +x /usr/local/bin/convert-dir.sh
COPY convert.sh /usr/local/bin/convert.sh
RUN chmod +x /usr/local/bin/convert.sh
WORKDIR /github/workspace
ENTRYPOINT ["/usr/local/bin/convert-dir.sh"]
ENTRYPOINT ["/usr/local/bin/convert.sh"]

View file

@ -6,22 +6,18 @@ if [ $# -ne 3 ]; then
exit 1
fi
# strip trailing slashes from input and output directories
# Strip trailing slashes from input and output directories
input_dir="${1%/}"
output_dir="${2%/}"
processed_dir="${3%/}"
# Find all .md files and check if the array is empty
mapfile -t md_files < <(find "$input_dir" -type f -name "*.md")
if [ ${#md_files[@]} -eq 0 ]; then
echo "No Markdown files to process."
exit 0
fi
# Iterate over .md files in input directory
for file in "$input_dir"/*.md; do
file=$(basename "$file")
# Convert yucky line endings
dos2unix "$input_dir/$file"
# Extract frontmatter and dump it to YAML file
echo "id: \"urn:uuid:$(uuidgen)\"" > "$output_dir/${file%.md}.yaml"
awk '/^---$/{if(seen){exit}else{seen=1;next}} seen' "$input_dir/$file" >> "$output_dir/${file%.md}.yaml"

View file

@ -6,18 +6,40 @@ on:
branches:
- main
paths:
- 'markdown/**'
- 'markdown/incoming/**'
concurrency:
group: md2gmi
cancel-in-progress: true
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
setup:
runs-on: ubuntu-latest
outputs:
work_to_do: ${{ steps.check_markdown.outputs.work_to_do }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.MY_GH_TOKEN }}
- name: Check for files to be processed
id: check_markdown
run: |
mapfile -t md_files < <(find markdown/incoming -type f -name "*.md")
if [ ${#md_files[@]} -eq 0 ]; then
echo "No Markdown files to process, exiting early."
echo "work_to_do=false" >> $GITHUB_OUTPUT
exit 0
else
echo "work_to_do=true" >> $GITHUB_OUTPUT
fi
md2gmi:
needs: setup
if: needs.setup.outputs.work_to_do == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -31,5 +53,3 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'convert Markdown post to Gempost'

View file

@ -1,17 +0,0 @@
This is a quick post to see if this absolute nonsense[1] I have cobbled together actually works.
=> https://github.com/jbowdre/capsule/blob/main/.github/workflows/markdown2gempost.yml 1: absolute nonsense
If it works:
- EchoFeed[1] will see this post in my Scribbles RSS feed, and relay it to my GitHub repo as a Markdown file.
=> https://echofeed.app/ 1: EchoFeed
- My new GitHub Actions workflow will see the new Markdown file, use a script and md2gmi[1] in a Docker container to convert the Markdown to Gemtext along with a YAML metadata sidecar for gempost, and store the results in the repo.
- The existing workflow will see the new gemtext post and use gempost[2] to (re)build the site, and then deploy it to my virtual server where it will be made available within Geminispace.
=> https://github.com/n0x1m/md2gmi 1: md2gmi
=> https://github.com/justlark/gempost 2: gempost
I really hope this works.

View file

@ -1 +0,0 @@
id: "urn:uuid:7826c3b3-fa43-4c55-9b7e-6b49879180ff"

View file

@ -0,0 +1,17 @@
I [posted *almost* a month ago](https://scribbles.jbowdre.lol/post/parking-scribbles-for-now-t9dty3yh) that I was pausing my Scribblesing while I focused on further adventures in Geminispace[1]. But then Robb Knight[2] went and released the much-anticipated EchoFeed[3], and I thought it might be fun to see if I could feed my Gemini capsule[4] from Scribbles.
=> https://geminiprotocol.net/ 1: Geminispace
=> https://robb.omg.lol/ 2: Robb Knight
=> https://echofeed.app 3: EchoFeed
=> https://capsule.jbowdre.lol 4: Gemini capsule
After tinkering with it quite a bit today, I think I've got a working (if not particularly elegant) solution.
Now, when EchoFeed sees a new post on my Scribbles feed, it copies the post to a Markdown file in the GitHub repo[1] I use for my capsule. A GitHub Actions workflow is triggered by the creation of that new Markdown file and converts it to the Gemtext format, complete with a YAML sidecar to hold metadata for gempost[2], a static site generator for Gemini. And then the creation of *that* file triggers another workflow which uses gempost to build the site and then push it to my server.
=> https://github.com/jbowdre/capsule 1: GitHub repo
=> https://github.com/justlark/gempost 2: gempost
Now I get to check out all the cool new stuff Vincent has been adding to Scribbles[1] while still maintaining a presence on the altweb. Very exciting!
=> https://scribbles.page/updates 1: cool new stuff Vincent has been adding to Scribbles

View file

@ -0,0 +1,4 @@
id: "urn:uuid:dced2ea6-2872-48d6-b97c-5e5350d588ee"
title: "From Scribbles to Gemini, with EchoFeed"
published: "2024-04-14T00:23:30.000000Z"
updated: "2024-04-14T00:23:30.000000Z"

View file

@ -1,15 +0,0 @@
---
title: "Echofeed Integration Test"
published: "2024-04-13T22:11:06.000000Z"
updated: "2024-04-13T22:11:06.000000Z"
---
This is a quick post to see if this [absolute nonsense](https://github.com/jbowdre/capsule/blob/main/.github/workflows/markdown2gempost.yml) I have cobbled together actually works.
If it works:
- [EchoFeed](https://echofeed.app/) will see this post in my Scribbles RSS feed, and relay it to my GitHub repo as a Markdown file.
- My new GitHub Actions workflow will see the new Markdown file, use a script and [md2gmi](https://github.com/n0x1m/md2gmi) in a Docker container to convert the Markdown to Gemtext along with a YAML metadata sidecar for gempost, and store the results in the repo.
- The existing workflow will see the new gemtext post and use [gempost](https://github.com/justlark/gempost) to (re)build the site, and then deploy it to my virtual server where it will be made available within Geminispace.
I really hope this works.

View file

@ -0,0 +1,13 @@
---
title: "From Scribbles to Gemini, with EchoFeed"
published: "2024-04-14T00:23:30.000000Z"
updated: "2024-04-14T00:23:30.000000Z"
---
I [posted *almost* a month ago](https://scribbles.jbowdre.lol/post/parking-scribbles-for-now-t9dty3yh) that I was pausing my Scribblesing while I focused on further adventures in [Geminispace](https://geminiprotocol.net/). But then [Robb Knight](https://robb.omg.lol/) went and released the much-anticipated [EchoFeed](https://echofeed.app), and I thought it might be fun to see if I could feed my [Gemini capsule](https://capsule.jbowdre.lol) from Scribbles.
After tinkering with it quite a bit today, I think I've got a working (if not particularly elegant) solution.
Now, when EchoFeed sees a new post on my Scribbles feed, it copies the post to a Markdown file in the [GitHub repo](https://github.com/jbowdre/capsule) I use for my capsule. A GitHub Actions workflow is triggered by the creation of that new Markdown file and converts it to the Gemtext format, complete with a YAML sidecar to hold metadata for [gempost](https://github.com/justlark/gempost), a static site generator for Gemini. And then the creation of *that* file triggers another workflow which uses gempost to build the site and then push it to my server.
Now I get to check out all the [cool new stuff Vincent has been adding to Scribbles](https://scribbles.page/updates) while still maintaining a presence on the altweb. Very exciting!

View file

@ -1,15 +0,0 @@
---
title: "Echofeed Integration Test"
published: "2024-04-13T23:01:36.000000Z"
updated: "2024-04-13T23:01:36.000000Z"
---
This is a quick post to see if this [absolute nonsense](https://github.com/jbowdre/capsule/blob/main/.github/workflows/markdown2gempost.yml) I have cobbled together actually works.
If it works:
- [EchoFeed](https://echofeed.app/) will see this post in my Scribbles RSS feed, and relay it to my GitHub repo as a Markdown file.
- My new GitHub Actions workflow will see the new Markdown file, use a script and [md2gmi](https://github.com/n0x1m/md2gmi) in a Docker container to convert the Markdown to Gemtext along with a YAML metadata sidecar for gempost, and store the results in the repo.
- The existing workflow will see the new gemtext post and use [gempost](https://github.com/justlark/gempost) to (re)build the site, and then deploy it to my virtual server where it will be made available within Geminispace.
I really hope this works.

View file

@ -4,6 +4,7 @@
## > /dev/stdout
=> /gemlog 📡 gemlog
=> gemini://gmi.runtimeterror.dev 💻 techy blog posts
=> https://scribbles.jbowdre.lol scribbles 'n bits
=> https://github.com/jbowdre code and kludges
## > /dev/net