This Week I Discovered
Happy Git repositories are all alike; every unhappy Git repository is unhappy in its own way. —Linus Tolstoy
Tools
Opensouce tools:
- Do Something .new, whats.new provides shortcuts for some services, I love gist.new, resume.new and docs.new.
- chsrc, as said in the brief. I tried to change my cargo registry, but it can't recognise my configured sources because I created
.cargo/config
to keep them. - git-sizer, an easy-to-use sizer tool, and mentioned some useful tips for building happy Git repositories.
- git-bomb, git-sizer mentioned this "git bomb".
Commercial tools:
- 18bit DNS, 18bit DNS is a AdGuardHome service hosted in China, it may works well, but the user can't feel how important they are.
- TradingView, data the market, interactive datasheet makes it easier to communicate.
- TablePlus, an elegent db client for Mac.
Projects
- Neobrutalism components, a collection of neobrutalism-styled Tailwind components.
This Week I Learned
GitHub Actions workflow in Gmeek project
Gmeek workflow file is here
Part 1, Events that trigger workflows used by Gmeek
workflow_dispatch
: manual operation would trigger the flow.issues
: issue events would trigger the flow.schedule
: trigger the workflow at a scheduled time.
Some of the events would also be recorded in the GitHub Webhook payload. After triggering the flow, some of the flow [variables](https://docs.github.com/en/actions/learn-github-actions/variables) would be changed.
Webhook event payload | Activity types | GITHUB_SHA after triggering |
GITHUB_REF after triggering |
---|---|---|---|
workflow_dispatch | Not applicable | Last commit on the GITHUB_REF branch or tag |
Branch or tag that received dispatch |
Not applicable | Not applicable | Last commit on default branch | Default branch |
issues |
- opened - edited - deleted - transferred - pinned - unpinned - closed - reopened - assigned - unassigned - labeled - unlabeled - locked - unlocked - milestoned - demilestoned |
Last commit on default branch | Default branch |
Part 2, Actions from GitHub Marketplace
checkout@v4
, this action on default fetch the single commit on$GITHUB_REF/$GITHUB_SHA
.configure-pages@v4
, this action on default enables Pages and extracts various metadata about the site.setup-python@v5
, this action setups Python environment including specific Python version, pack manager, and finally sets the path.upload-pages-artifact@v3
, this action composite the static assets to be deployed on GitHub Pages usingtar
command.deploy-pages@v4
, this action deploys the artifact uploaded in the action above.
All the workflows that build the repository and publish it to GitHub Pages commonly use the actions above, and GitHub provides a starter-workflow.
Part 3, Other jobs
- Cloning the generator script and templates
- the author uses
jq
command to parseGMEEK_VERSION
and decide which version to clone.
- the author uses
- Parsing configurations
- the author uses
json
package in the Python script to use other configurations, then generate HTMLs.
- the author uses
- Generate the blogs
- the author created a
GMEEK
class, it contains all the members and methods for creating the static assets- important members:
options
,user
- important methods:
defaultConfig()
, this function reads configs fromconfig.json
.markdown2html(mdstr)
, calls github's markdown api to get html.renderHtml(template, blogBase, postListJson, htmlDir, icon)
, loads templates and render the final html file.createPostHtml(issue)
, opens.md
file, gets.html
output by callingmarkdown2html()
, checks MathJax and alerts, configs the post info, render the final.html
by callingrenderHtml()
.
- important members:
- the author created a
- Commit and push to the repository.
JSON format and jq
command
I've been wrong about understanding JSON format for a long time, almost every programming language supports JSON.
JSON is a data-interchange format, a JSON object is an unordered set of name/value pairs seperated by comma.
jq
usage: jq tutorial, the tutorial takes jq's GitHub repository as example to show how the command should be use.
This Week I Built
A Blog
Blog site: immelon.top, thanks to Gmeek.
Gmeek uses GitHub Actions to render issues into HTMLs, then GitHub Pages render the repository on the <username>.github.io, comments on the issues would be rendered into comment widget of the blog by utterance
There are several other projects follows the road above(or similarily), they are different to some extent:
- Gitblog | Lightweight Blogging Solution, many more themes, provides analytics, needs to be paid for more than one blog under one account and API access(to analytics?).
- yihong0618/gitblog: People Die, but Long Live GitHub, opensource, but many complex configurations.
- GitHub - imuncle/gitblog, integrates configuration into one file, provides API access to the blog.
Which aspect of Gmeek attracts me most?
- Easy and fast, two-step configuration based on GitHub template repository, I can even configure nothing to start writing!
- Primer style UI, github's stable and pretty design system.