mirror of
https://github.com/jbowdre/capsule.git
synced 2024-11-23 05:22:19 +00:00
Compare commits
No commits in common. "1f71c2ed1d6d20ae49fca28f2e128aa08c37fcab" and "fa7f0b3157f51437fed865cd0f42aefb035e515d" have entirely different histories.
1f71c2ed1d
...
fa7f0b3157
11 changed files with 64 additions and 69 deletions
10
.github/actions/markdown2gempost/Dockerfile
vendored
10
.github/actions/markdown2gempost/Dockerfile
vendored
|
@ -11,15 +11,13 @@ RUN go mod download && CGO_ENABLED=0 GOOS=linux go build -o /md2gmi
|
||||||
FROM ubuntu:22.04 AS release
|
FROM ubuntu:22.04 AS release
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
|
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y uuid-runtime=2.37.2-4ubuntu3.4 \
|
||||||
dos2unix=7.4.2-2 \
|
|
||||||
uuid-runtime=2.37.2-4ubuntu3.4 \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=go-builder /md2gmi /usr/local/bin/md2gmi
|
COPY --from=go-builder /md2gmi /usr/local/bin/md2gmi
|
||||||
COPY convert.sh /usr/local/bin/convert.sh
|
COPY convert-dir.sh /usr/local/bin/convert-dir.sh
|
||||||
RUN chmod +x /usr/local/bin/convert.sh
|
RUN chmod +x /usr/local/bin/convert-dir.sh
|
||||||
|
|
||||||
WORKDIR /github/workspace
|
WORKDIR /github/workspace
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/convert.sh"]
|
ENTRYPOINT ["/usr/local/bin/convert-dir.sh"]
|
|
@ -6,18 +6,22 @@ if [ $# -ne 3 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Strip trailing slashes from input and output directories
|
# strip trailing slashes from input and output directories
|
||||||
input_dir="${1%/}"
|
input_dir="${1%/}"
|
||||||
output_dir="${2%/}"
|
output_dir="${2%/}"
|
||||||
processed_dir="${3%/}"
|
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
|
# Iterate over .md files in input directory
|
||||||
for file in "$input_dir"/*.md; do
|
for file in "$input_dir"/*.md; do
|
||||||
file=$(basename "$file")
|
file=$(basename "$file")
|
||||||
|
|
||||||
# Convert yucky line endings
|
|
||||||
dos2unix "$input_dir/$file"
|
|
||||||
|
|
||||||
# Extract frontmatter and dump it to YAML file
|
# Extract frontmatter and dump it to YAML file
|
||||||
echo "id: \"urn:uuid:$(uuidgen)\"" > "$output_dir/${file%.md}.yaml"
|
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"
|
awk '/^---$/{if(seen){exit}else{seen=1;next}} seen' "$input_dir/$file" >> "$output_dir/${file%.md}.yaml"
|
28
.github/workflows/markdown2gempost.yml
vendored
28
.github/workflows/markdown2gempost.yml
vendored
|
@ -6,40 +6,18 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'markdown/incoming/**'
|
- 'markdown/**'
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: md2gmi
|
group: md2gmi
|
||||||
cancel-in-progress: false
|
cancel-in-progress: true
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
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:
|
md2gmi:
|
||||||
needs: setup
|
|
||||||
if: needs.setup.outputs.work_to_do == 'true'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -53,3 +31,5 @@ jobs:
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: 'convert Markdown post to Gempost'
|
commit_message: 'convert Markdown post to Gempost'
|
||||||
|
|
||||||
|
|
||||||
|
|
17
gemlog/echofeed-integration-test.gmi
Normal file
17
gemlog/echofeed-integration-test.gmi
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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.
|
||||||
|
|
1
gemlog/echofeed-integration-test.yaml
Normal file
1
gemlog/echofeed-integration-test.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
id: "urn:uuid:7826c3b3-fa43-4c55-9b7e-6b49879180ff"
|
|
@ -1,17 +0,0 @@
|
||||||
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
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
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"
|
|
15
markdown/echofeed-integration-test.md
Normal file
15
markdown/echofeed-integration-test.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
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.
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
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!
|
|
15
markdown/incoming/echofeed-integration-test.md
Normal file
15
markdown/incoming/echofeed-integration-test.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
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.
|
|
@ -4,7 +4,6 @@
|
||||||
## > /dev/stdout
|
## > /dev/stdout
|
||||||
=> /gemlog 📡 gemlog
|
=> /gemlog 📡 gemlog
|
||||||
=> gemini://gmi.runtimeterror.dev 💻 techy blog posts
|
=> gemini://gmi.runtimeterror.dev 💻 techy blog posts
|
||||||
=> https://scribbles.jbowdre.lol scribbles 'n bits
|
|
||||||
=> https://github.com/jbowdre code and kludges
|
=> https://github.com/jbowdre code and kludges
|
||||||
|
|
||||||
## > /dev/net
|
## > /dev/net
|
||||||
|
|
Loading…
Reference in a new issue