mirror of
https://github.com/jbowdre/capsule.git
synced 2024-11-26 22:52:17 +00:00
Compare commits
10 commits
fa7f0b3157
...
1f71c2ed1d
Author | SHA1 | Date | |
---|---|---|---|
1f71c2ed1d | |||
92390b0145 | |||
|
de5a2ef099 | ||
36761b5621 | |||
70d1688757 | |||
11a0abd4c0 | |||
|
7253b83d76 | ||
b647d5a86a | |||
5d68275826 | |||
8c0e357654 |
11 changed files with 69 additions and 64 deletions
10
.github/actions/markdown2gempost/Dockerfile
vendored
10
.github/actions/markdown2gempost/Dockerfile
vendored
|
@ -11,13 +11,15 @@ 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 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/*
|
&& 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-dir.sh /usr/local/bin/convert-dir.sh
|
COPY convert.sh /usr/local/bin/convert.sh
|
||||||
RUN chmod +x /usr/local/bin/convert-dir.sh
|
RUN chmod +x /usr/local/bin/convert.sh
|
||||||
|
|
||||||
WORKDIR /github/workspace
|
WORKDIR /github/workspace
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/convert-dir.sh"]
|
ENTRYPOINT ["/usr/local/bin/convert.sh"]
|
|
@ -6,22 +6,18 @@ 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,18 +6,40 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'markdown/**'
|
- 'markdown/incoming/**'
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: md2gmi
|
group: md2gmi
|
||||||
cancel-in-progress: true
|
cancel-in-progress: false
|
||||||
|
|
||||||
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
|
||||||
|
@ -31,5 +53,3 @@ 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'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
id: "urn:uuid:7826c3b3-fa43-4c55-9b7e-6b49879180ff"
|
|
17
gemlog/from-scribbles-to-gemini-with-echofeed.gmi
Normal file
17
gemlog/from-scribbles-to-gemini-with-echofeed.gmi
Normal 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
|
||||||
|
|
4
gemlog/from-scribbles-to-gemini-with-echofeed.yaml
Normal file
4
gemlog/from-scribbles-to-gemini-with-echofeed.yaml
Normal 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"
|
|
@ -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.
|
|
13
markdown/from-scribbles-to-gemini-with-echofeed.md
Normal file
13
markdown/from-scribbles-to-gemini-with-echofeed.md
Normal 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!
|
|
@ -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.
|
|
|
@ -4,6 +4,7 @@
|
||||||
## > /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