mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-19 06:06:54 +00:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7efbed6a24 | ||
|
|
21d74f1183 | ||
|
|
d6d0098379 | ||
|
|
241bb4df78 | ||
|
|
82d8f2db98 | ||
|
|
9882244bd9 | ||
|
|
f243cbd858 | ||
|
|
d420b38329 | ||
|
|
ea2d238bd8 | ||
|
|
5234511a2f | ||
|
|
746a31e125 | ||
|
|
c45e031155 | ||
|
|
4a2b89d0b6 | ||
|
|
2a4fbf6a79 | ||
|
|
84ea68cab0 | ||
|
|
3ed5eb1ee0 | ||
|
|
60836af606 | ||
|
|
739345ac24 | ||
|
|
1a977a87a0 | ||
|
|
d1a5b57e4d | ||
|
|
2b9d379d70 | ||
|
|
bdee5d6b6d | ||
|
|
348f6bff8b | ||
|
|
7a3d624364 | ||
|
|
06f1c6f256 | ||
|
|
4a7f33f7bb | ||
|
|
e077d2911d | ||
|
|
5f2edb0914 | ||
|
|
911206be80 | ||
|
|
18808851a9 | ||
|
|
2bf87e0de7 | ||
|
|
f6d96ab2b8 | ||
|
|
59c55121c7 | ||
|
|
9f174d9088 | ||
|
|
5810bcd1d7 | ||
|
|
897b57bfb4 |
@@ -1,5 +0,0 @@
|
||||
# https://github.com/browserslist/browserslist#browserslistrc
|
||||
|
||||
last 2 versions
|
||||
> 0.2%
|
||||
not dead
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
"body-max-line-length": [
|
||||
0,
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
||||
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -7,7 +7,7 @@ updates:
|
||||
bundler:
|
||||
dependency-type: "production"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
interval: "monthly"
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
versioning-strategy: increase
|
||||
@@ -15,7 +15,7 @@ updates:
|
||||
npm:
|
||||
dependency-type: "development"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
interval: "monthly"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
groups:
|
||||
@@ -23,4 +23,4 @@ updates:
|
||||
update-types:
|
||||
- "major"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
interval: "monthly"
|
||||
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: [2.7, 3]
|
||||
ruby: ["3.0", "3.1", "3.2"]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
bundler-cache: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
- name: Build Assets
|
||||
run: npm i && npm run build
|
||||
|
||||
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@@ -29,16 +29,16 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: "${{ matrix.language }}"
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
||||
|
||||
2
.github/workflows/pages-deploy.yml.hook
vendored
2
.github/workflows/pages-deploy.yml.hook
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3
|
||||
ruby-version: 3.2
|
||||
bundler-cache: true
|
||||
|
||||
- name: Build site
|
||||
|
||||
28
.github/workflows/stale.yml
vendored
28
.github/workflows/stale.yml
vendored
@@ -8,23 +8,25 @@ permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
STALE_LABEL: stale
|
||||
EXEMPT_LABELS: "pending,planning,in progress"
|
||||
MESSAGE: >
|
||||
This conversation has been automatically marked as stale because it has not had recent activity.
|
||||
It will be closed if no further activity occurs.
|
||||
Thank you for your contributions.
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v8
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
days-before-stale: 30
|
||||
days-before-close: 1
|
||||
stale-issue-label: stale
|
||||
exempt-issue-labels: pending
|
||||
stale-issue-message: >
|
||||
This issue has been automatically marked as stale because it has not had recent activity.
|
||||
It will be closed if no further activity occurs.
|
||||
Thank you for your contributions.
|
||||
stale-pr-label: stale
|
||||
exempt-pr-labels: pending
|
||||
stale-pr-message: >
|
||||
This PR has been automatically marked as stale because it has not had recent activity.
|
||||
It will be closed if no further activity occurs.
|
||||
Thank you for your contributions.
|
||||
stale-issue-label: ${{ env.STALE_LABEL }}
|
||||
exempt-issue-labels: ${{ env.EXEMPT_LABELS }}
|
||||
stale-issue-message: ${{ env.MESSAGE }}
|
||||
stale-pr-label: ${{ env.STALE_LABEL }}
|
||||
exempt-pr-labels: ${{ env.EXEMPT_LABELS }}
|
||||
stale-pr-message: ${{ env.MESSAGE }}
|
||||
|
||||
2
.github/workflows/style-lint.yml
vendored
2
.github/workflows/style-lint.yml
vendored
@@ -20,6 +20,6 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
- run: npm i
|
||||
- run: npm test
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"trailingComma": "none"
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"extends": "stylelint-config-standard-scss",
|
||||
"rules": {
|
||||
"no-descending-specificity": null,
|
||||
"shorthand-property-no-redundant-values": null,
|
||||
"at-rule-no-vendor-prefix": null,
|
||||
"property-no-vendor-prefix": null,
|
||||
"selector-no-vendor-prefix": null,
|
||||
"value-no-vendor-prefix": null,
|
||||
"color-function-notation": "legacy",
|
||||
"alpha-value-notation": "number",
|
||||
"selector-not-notation": "simple",
|
||||
"color-hex-length": "long",
|
||||
"declaration-block-single-line-max-declarations": 3,
|
||||
"scss/operator-no-newline-after": null,
|
||||
"rule-empty-line-before": [
|
||||
"always",
|
||||
{ "ignore": ["after-comment", "first-nested"] }
|
||||
],
|
||||
"value-keyword-case": ["lower", { "ignoreProperties": ["/^\\$/"] }],
|
||||
"media-feature-range-notation": "prefix"
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"skip": {
|
||||
"commit": true,
|
||||
"tag": true
|
||||
},
|
||||
"types": [
|
||||
{
|
||||
"type": "feat",
|
||||
"section": "Features"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes"
|
||||
},
|
||||
{
|
||||
"type": "perf",
|
||||
"section": "Improvements"
|
||||
}
|
||||
]
|
||||
}
|
||||
35
README.md
35
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
# Chirpy Jekyll Theme
|
||||
|
||||
A minimal, responsive and feature-rich Jekyll theme for technical writing.
|
||||
A minimal, responsive, and feature-rich Jekyll theme for technical writing.
|
||||
|
||||
[][gem]
|
||||
[][ci]
|
||||
@@ -10,7 +10,7 @@
|
||||
[][license]
|
||||
[](https://996.icu)
|
||||
|
||||
[**Live Demo →**][demo]
|
||||
[**Live Demo** →][demo]
|
||||
|
||||
[][demo]
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
|
||||
## Features
|
||||
|
||||
<details>
|
||||
<summary>Click to expand/close details</summary>
|
||||
|
||||
|
||||
- Dark / Light Theme Mode
|
||||
- Localized UI language
|
||||
- Pinned Posts on Home Page
|
||||
@@ -41,8 +37,6 @@
|
||||
- Google Analytics
|
||||
- SEO & Performance Optimization
|
||||
|
||||
</details>
|
||||
|
||||
## Documentation
|
||||
|
||||
To learn how to use, develop, and upgrade the project, please refer to the [Wiki][wiki].
|
||||
@@ -55,22 +49,18 @@ For details, see the "[Contributing Guidelines][contribute-guide]".
|
||||
|
||||
## Credits
|
||||
|
||||
This project is mainly built with [Jekyll][jekyllrb] ecosystem,
|
||||
[Bootstrap][bootstrap], [Font Awesome][icons], and some other [wonderful tools][lib].
|
||||
The avatar and favicon design come from [Clipart Max][image].
|
||||
### Contributors
|
||||
|
||||
Many thanks to the [contributors][contributors] who participated in the development
|
||||
and to the folks who reported bugs or shared ideas.
|
||||
Thanks to [all the contributors][contributors] involved in the development of the project!
|
||||
|
||||
Last but not least, thanks to [JetBrains][jetbrains] for providing the _Open Source License_.
|
||||
[][contributors]
|
||||
<sub> —— Made with [contrib.rocks](https://contrib.rocks)</sub>
|
||||
|
||||
## Sponsoring
|
||||
### Third-Party Assets
|
||||
|
||||
If you like this project or have built something through it, please consider sponsoring it, and your support would be greatly appreciated.
|
||||
This project is built on the [Jekyll][jekyllrb] ecosystem and some [great libraries][lib], and is developed using [VS Code][vscode] as well as tools provided by [JetBrains][jetbrains] under a non-commercial open-source software license.
|
||||
|
||||
[][ko-fi]
|
||||
[][donation]
|
||||
[][donation]
|
||||
The avatar and favicon for the project's website are from [ClipartMAX][clipartmax].
|
||||
|
||||
## License
|
||||
|
||||
@@ -81,14 +71,11 @@ This project is published under [MIT License][license].
|
||||
[codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade
|
||||
[license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE
|
||||
[jekyllrb]: https://jekyllrb.com/
|
||||
[bootstrap]: https://getbootstrap.com/
|
||||
[icons]: https://fontawesome.com/
|
||||
[image]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/
|
||||
[clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/
|
||||
[demo]: https://cotes2020.github.io/chirpy-demo/
|
||||
[wiki]: https://github.com/cotes2020/jekyll-theme-chirpy/wiki
|
||||
[contribute-guide]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md
|
||||
[contributors]: https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors
|
||||
[lib]: https://github.com/cotes2020/chirpy-static-assets
|
||||
[vscode]: https://code.visualstudio.com/
|
||||
[jetbrains]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
||||
[ko-fi]: https://ko-fi.com/coteschung/
|
||||
[donation]: https://sponsor.cotes.page/
|
||||
|
||||
@@ -75,6 +75,10 @@ img_cdn: "https://chirpy-img.netlify.app"
|
||||
# the avatar on sidebar, support local or CORS resources
|
||||
avatar: "/commons/avatar.jpg"
|
||||
|
||||
# The URL of the site-wide social preview image used in SEO `og:image` meta tag.
|
||||
# It can be overridden by a customized `page.image` in front matter.
|
||||
social_preview_image: # string, local or CORS resources
|
||||
|
||||
# boolean type, the global switch for TOC in posts.
|
||||
toc: true
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ copyright:
|
||||
Except where otherwise noted, the blog posts on this site are licensed
|
||||
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
|
||||
|
||||
meta: Using the :THEME theme for :PLATFORM
|
||||
meta: Using the :THEME theme for :PLATFORM.
|
||||
|
||||
not_found:
|
||||
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
|
||||
|
||||
@@ -23,17 +23,17 @@ bootstrap:
|
||||
js: https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js
|
||||
|
||||
toc:
|
||||
css: https://cdn.jsdelivr.net/npm/tocbot@4.21.2/dist/tocbot.min.css
|
||||
js: https://cdn.jsdelivr.net/npm/tocbot@4.21.2/dist/tocbot.min.js
|
||||
css: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.css
|
||||
js: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.js
|
||||
|
||||
fontawesome:
|
||||
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css
|
||||
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/css/all.min.css
|
||||
|
||||
search:
|
||||
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
|
||||
|
||||
mermaid:
|
||||
js: https://cdn.jsdelivr.net/npm/mermaid@10.5.0/dist/mermaid.min.js
|
||||
js: https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js
|
||||
|
||||
dayjs:
|
||||
js:
|
||||
|
||||
@@ -23,3 +23,16 @@ platforms:
|
||||
# - type: Weibo
|
||||
# icon: "fab fa-weibo"
|
||||
# link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL"
|
||||
#
|
||||
# - type: Mastodon
|
||||
# icon: "fa-brands fa-mastodon"
|
||||
# # See: https://github.com/justinribeiro/share-to-mastodon#properties
|
||||
# instances:
|
||||
# - label: mastodon.social
|
||||
# link: "https://mastodon.social/"
|
||||
# - label: mastodon.online
|
||||
# link: "https://mastodon.online/"
|
||||
# - label: fosstodon.org
|
||||
# link: "https://fosstodon.org/"
|
||||
# - label: photog.social
|
||||
# link: "https://photog.social/"
|
||||
|
||||
10
_includes/embed/bilibili.html
Normal file
10
_includes/embed/bilibili.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<iframe
|
||||
class="embed-video bilibili"
|
||||
loading="lazy"
|
||||
src="https://player.bilibili.com/player.html?bvid={{ include.id }}"
|
||||
scrolling="no"
|
||||
border="0"
|
||||
frameborder="no"
|
||||
framespacing="0"
|
||||
allowfullscreen="true"
|
||||
></iframe>
|
||||
@@ -1,5 +1,6 @@
|
||||
<iframe
|
||||
class="embed-video twitch"
|
||||
loading="lazy"
|
||||
src="https://player.twitch.tv/?video={{ include.id }}&parent={{ site.url | split: '://' | last | remove: '/' }}"
|
||||
frameborder="0"
|
||||
allowfullscreen="true"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<!-- The Head -->
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
|
||||
@@ -11,29 +9,38 @@
|
||||
content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
|
||||
>
|
||||
|
||||
{% capture seo_tags %}
|
||||
{%- capture seo_tags -%}
|
||||
{% seo title=false %}
|
||||
{% endcapture %}
|
||||
{%- endcapture -%}
|
||||
|
||||
<!-- Setup Open Graph image -->
|
||||
|
||||
{% if page.image %}
|
||||
{% assign img = page.image.path | default: page.image %}
|
||||
{% assign src = page.image.path | default: page.image %}
|
||||
|
||||
{% unless img contains '://' %}
|
||||
{% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
|
||||
{% capture target %}"{{ img | absolute_url }}"{% endcapture %}
|
||||
{% unless src contains '://' %}
|
||||
{%- capture img_url -%}
|
||||
{% include img-url.html src=src img_path=page.img_path %}
|
||||
{%- endcapture -%}
|
||||
|
||||
{% if site.img_cdn contains '//' %}
|
||||
<!-- it's a cross-origin URL -->
|
||||
{% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
|
||||
{% else %}
|
||||
<!-- it's a local file path -->
|
||||
{%- capture replacement -%}
|
||||
"{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
|
||||
{%- endcapture -%}
|
||||
{% endif %}
|
||||
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
|
||||
{%- capture new_url -%}{{ img_url }}{%- endcapture -%}
|
||||
|
||||
{% assign seo_tags = seo_tags | replace: target, replacement %}
|
||||
{% assign seo_tags = seo_tags | replace: old, new %}
|
||||
{% endunless %}
|
||||
|
||||
{% elsif site.social_preview_image %}
|
||||
{%- capture img_url -%}
|
||||
{% include img-url.html src=site.social_preview_image %}
|
||||
{%- endcapture -%}
|
||||
|
||||
{%- capture og_image -%}
|
||||
<meta property="og:image" content="{{ img_url }}" />
|
||||
{%- endcapture -%}
|
||||
|
||||
{% assign old_meta_clip = '<meta name="twitter:card"' %}
|
||||
{% assign new_meta_clip = og_image | append: old_meta_clip %}
|
||||
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
|
||||
{% endif %}
|
||||
|
||||
{{ seo_tags }}
|
||||
|
||||
24
_includes/img-url.html
Normal file
24
_includes/img-url.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{%- comment -%}
|
||||
Generate image final URL based on `site.img_cdn`, `page.img_path`
|
||||
|
||||
Arguments:
|
||||
src - basic image path, required
|
||||
img_path - relative path of image, optional
|
||||
|
||||
Return:
|
||||
image URL
|
||||
{%- endcomment -%}
|
||||
|
||||
{% assign url = include.src %}
|
||||
|
||||
{%- if url -%}
|
||||
{%- comment -%} CND URL {%- endcomment -%}
|
||||
{% assign prefix = site.img_cdn | default: '' | relative_url %}
|
||||
|
||||
{%- comment -%} Add page image path prefix {%- endcomment -%}
|
||||
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
|
||||
|
||||
{% assign url = prefix | append: '/' | append: url | replace: '///', '/' | replace: '//', '/' | replace: ':', ':/' %}
|
||||
{%- endif -%}
|
||||
|
||||
{{- url -}}
|
||||
@@ -1,23 +1,38 @@
|
||||
<!-- Post sharing snippet -->
|
||||
|
||||
<div class="share-wrapper d-flex align-items-center">
|
||||
<span class="share-label text-muted me-1">{{ site.data.locales[include.lang].post.share }}</span>
|
||||
<span class="share-label text-muted">{{ site.data.locales[include.lang].post.share }}</span>
|
||||
<span class="share-icons">
|
||||
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
||||
{% assign title = title | uri_escape %}
|
||||
{% assign url = page.url | absolute_url | url_encode %}
|
||||
|
||||
{% for share in site.data.share.platforms %}
|
||||
{% for share in site.data.share.platforms -%}
|
||||
{%- capture tooltip -%}
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" title="{{ share.type }}" aria-label="{{ share.type }}"
|
||||
{%- endcapture -%}
|
||||
|
||||
{% if share.type == 'Mastodon' %}
|
||||
<script defer type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/share-to-mastodon/+esm"></script>
|
||||
<button class="btn text-start" {{ tooltip }}>
|
||||
<share-to-mastodon
|
||||
class="share-mastodon"
|
||||
message="{{ title }}"
|
||||
url="{{ url }}"
|
||||
{%- if share.instances -%}
|
||||
customInstanceList="{{ share.instances | jsonify | xml_escape }}"
|
||||
{%- endif %}
|
||||
>
|
||||
<i class="fa-fw {{ share.icon }}"></i>
|
||||
</share-to-mastodon>
|
||||
</button>
|
||||
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
|
||||
<a
|
||||
href="{{ link }}"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ share.type }}"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label="{{ share.type }}"
|
||||
>
|
||||
|
||||
<a href="{{ link }}" target="_blank" rel="noopener" {{ tooltip }}>
|
||||
<i class="fa-fw {{ share.icon }}"></i>
|
||||
</a>
|
||||
{% endfor %}
|
||||
@@ -31,7 +46,7 @@
|
||||
title="{{ site.data.locales[include.lang].post.button.share_link.title }}"
|
||||
data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}"
|
||||
>
|
||||
<i class="fa-fw fas fa-link pe-none"></i>
|
||||
<i class="fa-fw fas fa-link pe-none fs-6"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -48,23 +48,6 @@
|
||||
{% assign _img_content = null %}
|
||||
{% assign _img_snippets = _content | split: IMG_TAG %}
|
||||
|
||||
<!-- CDN URL -->
|
||||
{% if site.img_cdn %}
|
||||
{% if site.img_cdn contains '//' %}
|
||||
{% assign _path_prefix = site.img_cdn %}
|
||||
{% else %}
|
||||
{% assign _path_prefix = site.img_cdn | relative_url %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% assign _path_prefix = site.baseurl %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Add image path -->
|
||||
{% if page.img_path %}
|
||||
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
|
||||
{% assign _path_prefix = _path_prefix | append: _path %}
|
||||
{% endif %}
|
||||
|
||||
{% for _img_snippet in _img_snippets %}
|
||||
{% if forloop.first %}
|
||||
{% assign _img_content = _img_snippet %}
|
||||
@@ -113,6 +96,12 @@
|
||||
{% assign _final_src = null %}
|
||||
{% assign _lazyload = true %}
|
||||
|
||||
{%- capture _img_url -%}
|
||||
{% include img-url.html src=_src img_path=page.img_path %}
|
||||
{%- endcapture -%}
|
||||
|
||||
{% assign _path_prefix = _img_url | remove: _src %}
|
||||
|
||||
{% unless _src contains '//' %}
|
||||
{% assign _final_src = _path_prefix | append: _src %}
|
||||
{% assign _src_alt = 'src="' | append: _path_prefix %}
|
||||
|
||||
@@ -3,18 +3,12 @@
|
||||
<aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
|
||||
<header class="profile-wrapper">
|
||||
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
|
||||
{% if site.avatar != empty and site.avatar %}
|
||||
{% capture avatar_url %}
|
||||
{% if site.avatar contains '://' %}
|
||||
{{ site.avatar }}
|
||||
{% elsif site.img_cdn != empty and site.img_cdn %}
|
||||
{{ site.avatar | prepend: site.img_cdn }}
|
||||
{% else %}
|
||||
{{ site.avatar | relative_url }}
|
||||
{% endif %}
|
||||
{% endcapture %}
|
||||
<img src="{{ avatar_url | strip }}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
|
||||
{% endif %}
|
||||
{%- if site.avatar != empty and site.avatar -%}
|
||||
{%- capture avatar_url -%}
|
||||
{% include img-url.html src=site.avatar %}
|
||||
{%- endcapture -%}
|
||||
<img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
|
||||
{%- endif -%}
|
||||
</a>
|
||||
|
||||
<h1 class="site-title">
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<!-- Get the last 5 posts from lastmod list. -->
|
||||
<!-- Get 5 last posted/updated posts -->
|
||||
|
||||
{% assign MAX_SIZE = 5 %}
|
||||
|
||||
{% assign all_list = '' | split: '' %}
|
||||
|
||||
{% for post in site.posts %}
|
||||
{% if post.last_modified_at and post.last_modified_at != post.date %}
|
||||
{% capture elem %}
|
||||
{{- post.last_modified_at | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
|
||||
{% endcapture %}
|
||||
{% assign all_list = all_list | push: elem %}
|
||||
{% endif %}
|
||||
{% assign datetime = post.last_modified_at | default: post.date %}
|
||||
|
||||
{% capture elem %}
|
||||
{{- datetime | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
|
||||
{% endcapture %}
|
||||
|
||||
{% assign all_list = all_list | push: elem %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign all_list = all_list | sort | reverse %}
|
||||
|
||||
@@ -61,7 +61,11 @@ tail_includes:
|
||||
<em>
|
||||
{% if authors %}
|
||||
{% for author in authors %}
|
||||
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
|
||||
{% if site.data.authors[author].url -%}
|
||||
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
|
||||
{%- else -%}
|
||||
{{ site.data.authors[author].name }}
|
||||
{%- endif %}
|
||||
{% unless forloop.last %}{{ '</em>, <em>' }}{% endunless %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
||||
@@ -424,12 +424,11 @@ Where `Platform` is the lowercase of the platform name, and `ID` is the video ID
|
||||
|
||||
The following table shows how to get the two parameters we need in a given video URL, and you can also know the currently supported video platforms.
|
||||
|
||||
| Video URL | Platform | ID |
|
||||
|----------------------------------------------------------------------------------------------------|-----------|:--------------|
|
||||
| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` |
|
||||
| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` |
|
||||
|
||||
|
||||
| Video URL | Platform | ID |
|
||||
| -------------------------------------------------------------------------------------------------- | ---------- | :------------- |
|
||||
| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` |
|
||||
| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` |
|
||||
| [https://www.**bilibili**.com/video/**BV1Q44y1B7Wf**](https://www.bilibili.com/video/BV1Q44y1B7Wf) | `bilibili` | `BV1Q44y1B7Wf` |
|
||||
|
||||
## Learn More
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ blockquote {
|
||||
border-left: 5px solid var(--blockquote-border-color);
|
||||
padding-left: 1rem;
|
||||
color: var(--blockquote-text-color);
|
||||
display: flex;
|
||||
|
||||
> p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&[class^='prompt-'] {
|
||||
border-left: 0;
|
||||
@@ -103,10 +108,6 @@ blockquote {
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
> p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@include prompt('tip', '\f0eb', 'regular');
|
||||
@@ -324,6 +325,10 @@ sup {
|
||||
object-fit: cover;
|
||||
|
||||
@extend %rounded;
|
||||
|
||||
@at-root #post-list & {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +552,8 @@ main {
|
||||
|
||||
@extend %rounded;
|
||||
|
||||
&.youtube {
|
||||
&.youtube,
|
||||
&.bilibili {
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
|
||||
@@ -636,12 +642,12 @@ main {
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
margin: 0.75rem 1rem 1rem 0 !important;
|
||||
margin: 0.75rem 1rem 1rem 0;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
margin: 0.75rem 0 1rem 1rem !important;
|
||||
margin: 0.75rem 0 1rem 1rem;
|
||||
}
|
||||
|
||||
/* --- Overriding --- */
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
|
||||
/* Posts */
|
||||
--toc-highlight: #0550ae;
|
||||
--btn-share-hover-color: var(--link-color);
|
||||
--btn-share-color: gray;
|
||||
--btn-share-hover-color: #0d6efd;
|
||||
--card-bg: white;
|
||||
--card-hovor-bg: #e2e2e2;
|
||||
--card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0,
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
Post-specific style
|
||||
*/
|
||||
|
||||
@mixin btn-sharing-color($light-color, $important: false) {
|
||||
@if $important {
|
||||
color: var(--btn-share-color, $light-color) !important;
|
||||
} @else {
|
||||
color: var(--btn-share-color, $light-color);
|
||||
}
|
||||
}
|
||||
|
||||
%btn-post-nav {
|
||||
width: 50%;
|
||||
position: relative;
|
||||
@@ -72,11 +64,23 @@ h1 + .post-meta {
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
%icon-size {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
.share-icons {
|
||||
font-size: 1.2rem;
|
||||
display: flex;
|
||||
|
||||
i {
|
||||
color: var(--btn-share-color);
|
||||
|
||||
@extend %icon-size;
|
||||
}
|
||||
|
||||
> * {
|
||||
margin-left: 0.25rem;
|
||||
@extend %icon-size;
|
||||
|
||||
margin-left: 0.5rem;
|
||||
|
||||
&:hover {
|
||||
i {
|
||||
@@ -86,44 +90,29 @@ h1 + .post-meta {
|
||||
}
|
||||
|
||||
button {
|
||||
position: relative;
|
||||
bottom: 2px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
line-height: inherit;
|
||||
|
||||
@extend %cursor-pointer;
|
||||
}
|
||||
|
||||
a :hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.fa-square-x-twitter {
|
||||
@include btn-sharing-color(black);
|
||||
}
|
||||
|
||||
.fa-facebook-square {
|
||||
@include btn-sharing-color(rgb(66, 95, 156));
|
||||
}
|
||||
|
||||
.fa-telegram {
|
||||
@include btn-sharing-color(rgb(39, 159, 217));
|
||||
}
|
||||
|
||||
.fa-linkedin {
|
||||
@include btn-sharing-color(rgb(0, 119, 181));
|
||||
}
|
||||
|
||||
.fa-weibo {
|
||||
@include btn-sharing-color(rgb(229, 20, 43));
|
||||
}
|
||||
} /* .share-icons */
|
||||
|
||||
.fas.fa-link {
|
||||
@include btn-sharing-color(rgb(171, 171, 171));
|
||||
}
|
||||
} /* .share-wrapper */
|
||||
}
|
||||
|
||||
.share-mastodon {
|
||||
/* See: https://github.com/justinribeiro/share-to-mastodon#properties */
|
||||
--wc-stm-font-family: $font-family-base;
|
||||
--wc-stm-dialog-background-color: var(--card-bg);
|
||||
--wc-stm-form-button-border: 1px solid var(--btn-border-color);
|
||||
--wc-stm-form-submit-background-color: var(--sidebar-btn-bg);
|
||||
--wc-stm-form-cancel-background-color: var(--sidebar-btn-bg);
|
||||
--wc-stm-form-button-background-color-hover: #007bff;
|
||||
--wc-stm-form-button-color-hover: white;
|
||||
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.post-tags {
|
||||
line-height: 2rem;
|
||||
|
||||
|
||||
Submodule assets/lib updated: 6e3fa73468...c57724981c
@@ -2,6 +2,39 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [6.4.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.3.1...v6.4.0) (2024-01-10)
|
||||
|
||||
### Features
|
||||
|
||||
* add bilibili embed video support ([#1406](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1406)) ([4a2b89d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4a2b89d0b698d672486349131a89025fa47afcb6))
|
||||
* add site-wide social preview image settings ([#1463](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1463)) ([241bb4d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/241bb4df7878cff7f82014df660874a1dcddba76))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* image float breaks quotes and prompts ([#1449](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1449)) ([ea2d238](https://github.com/cotes2020/jekyll-theme-chirpy/commit/ea2d238bd8adc018256862e05a5092311c87a671)), closes [#1441](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1441)
|
||||
* url-less authors should not have empty links ([#1410](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1410)) ([2a4fbf6](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2a4fbf6a7925da610a75c498116da7cf9ba857d7)), closes [#1403](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1403)
|
||||
|
||||
### Improvements
|
||||
|
||||
* include the latest posts in the "Recently Updated" list ([#1456](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1456)) ([82d8f2d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/82d8f2db984711f334f55b6af5098ec16770e824))
|
||||
|
||||
## [6.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.3.0...v6.3.1) (2023-11-12)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **home:** responsive gap at the bottom of preview image ([1a977a8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/1a977a87a0da1cff35d0896cf9265c31034841a6))
|
||||
|
||||
## [6.3.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.2.3...v6.3.0) (2023-11-10)
|
||||
|
||||
### Features
|
||||
|
||||
* add Mastodon sharing link ([#1344](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1344)) ([2bf87e0](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2bf87e0de7928f325811e1bb96cfcaefdf6cf66a)), closes [#1324](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1324)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **home:** crop the preview image that doesn't match 1.91:1 ([#1325](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1325)) ([5810bcd](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5810bcd1d7b83e111017831fa82c368a6b15c7cd))
|
||||
* resume lazy loading for Twitch videos ([#1326](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1326)) ([9f174d9](https://github.com/cotes2020/jekyll-theme-chirpy/commit/9f174d9088e5c83a5e0c4630336cea65e199c553)), closes [#1267](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1267)
|
||||
|
||||
## [6.2.3](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.2.2...v6.2.3) (2023-10-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "jekyll-theme-chirpy"
|
||||
spec.version = "6.2.3"
|
||||
spec.version = "6.4.0"
|
||||
spec.authors = ["Cotes Chung"]
|
||||
spec.email = ["cotes.chung@gmail.com"]
|
||||
|
||||
spec.summary = "A minimal, responsive and feature-rich Jekyll theme for technical writing."
|
||||
spec.summary = "A minimal, responsive, and feature-rich Jekyll theme for technical writing."
|
||||
spec.homepage = "https://github.com/cotes2020/jekyll-theme-chirpy"
|
||||
spec.license = "MIT"
|
||||
|
||||
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
|
||||
"plugin_type" => "theme"
|
||||
}
|
||||
|
||||
spec.required_ruby_version = ">= 2.6"
|
||||
spec.required_ruby_version = ">= 3.0"
|
||||
|
||||
spec.add_runtime_dependency "jekyll", "~> 4.3"
|
||||
spec.add_runtime_dependency "jekyll-paginate", "~> 1.1"
|
||||
spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16"
|
||||
spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.7"
|
||||
spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.8"
|
||||
spec.add_runtime_dependency "jekyll-archives", "~> 2.2"
|
||||
spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4"
|
||||
spec.add_runtime_dependency "jekyll-include-cache", "~> 0.2"
|
||||
|
||||
91
package.json
91
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jekyll-theme-chirpy",
|
||||
"version": "6.2.3",
|
||||
"description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.",
|
||||
"version": "6.4.0",
|
||||
"description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cotes2020/jekyll-theme-chirpy.git"
|
||||
@@ -21,15 +21,86 @@
|
||||
"fixlint": "npm run test -- --fix"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.0",
|
||||
"@babel/core": "^7.23.7",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/preset-env": "^7.22.20",
|
||||
"@rollup/plugin-babel": "^6.0.3",
|
||||
"@rollup/plugin-terser": "^0.4.3",
|
||||
"@babel/preset-env": "^7.23.7",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"rimraf": "^5.0.5",
|
||||
"rollup": "^3.29.4",
|
||||
"rollup-plugin-license": "^3.1.0",
|
||||
"stylelint": "^15.10.3",
|
||||
"stylelint-config-standard-scss": "^11.0.0"
|
||||
"rollup": "^4.9.2",
|
||||
"rollup-plugin-license": "^3.2.0",
|
||||
"stylelint": "^16.1.0",
|
||||
"stylelint-config-standard-scss": "^12.0.0"
|
||||
},
|
||||
"prettier": {
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 2 versions",
|
||||
"> 0.2%",
|
||||
"not dead"
|
||||
],
|
||||
"commitlint": {
|
||||
"rules": {
|
||||
"body-max-line-length": [
|
||||
0,
|
||||
"always"
|
||||
]
|
||||
}
|
||||
},
|
||||
"stylelint": {
|
||||
"extends": "stylelint-config-standard-scss",
|
||||
"rules": {
|
||||
"no-descending-specificity": null,
|
||||
"shorthand-property-no-redundant-values": null,
|
||||
"at-rule-no-vendor-prefix": null,
|
||||
"property-no-vendor-prefix": null,
|
||||
"selector-no-vendor-prefix": null,
|
||||
"value-no-vendor-prefix": null,
|
||||
"color-function-notation": "legacy",
|
||||
"alpha-value-notation": "number",
|
||||
"selector-not-notation": "simple",
|
||||
"color-hex-length": "long",
|
||||
"declaration-block-single-line-max-declarations": 3,
|
||||
"scss/operator-no-newline-after": null,
|
||||
"rule-empty-line-before": [
|
||||
"always",
|
||||
{
|
||||
"ignore": [
|
||||
"after-comment",
|
||||
"first-nested"
|
||||
]
|
||||
}
|
||||
],
|
||||
"value-keyword-case": [
|
||||
"lower",
|
||||
{
|
||||
"ignoreProperties": [
|
||||
"/^\\$/"
|
||||
]
|
||||
}
|
||||
],
|
||||
"media-feature-range-notation": "prefix"
|
||||
}
|
||||
},
|
||||
"standard-version": {
|
||||
"skip": {
|
||||
"commit": true,
|
||||
"tag": true
|
||||
},
|
||||
"types": [
|
||||
{
|
||||
"type": "feat",
|
||||
"section": "Features"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes"
|
||||
},
|
||||
{
|
||||
"type": "perf",
|
||||
"section": "Improvements"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# and production branch.
|
||||
#
|
||||
#
|
||||
# Usage: run on main branch or the patch branch
|
||||
# Usage: run on the default, release or the patch branch
|
||||
#
|
||||
# Requires: Git, NPM and RubyGems
|
||||
|
||||
@@ -18,8 +18,7 @@ opt_pre=false # preview mode option
|
||||
|
||||
working_branch="$(git branch --show-current)"
|
||||
|
||||
# AKA the default branch, main/master branch
|
||||
STAGING_BRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
|
||||
DEFAULT_BRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
|
||||
|
||||
PROD_BRANCH="production"
|
||||
|
||||
@@ -65,15 +64,16 @@ _check_cli() {
|
||||
}
|
||||
|
||||
_check_git() {
|
||||
# ensure nothing is uncommitted
|
||||
# ensure that changes have been committed
|
||||
if [[ -n $(git status . -s) ]]; then
|
||||
echo "> Abort: Commit the staged files first, and then run this tool again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ensure the working branch is the default/patch branch
|
||||
if [[ $working_branch != "$STAGING_BRANCH" && $working_branch != hotfix/* ]]; then
|
||||
echo "> Abort: Please run on the $STAGING_BRANCH branch or a patch branche."
|
||||
if [[ $working_branch != "$DEFAULT_BRANCH" &&
|
||||
$working_branch != hotfix/* &&
|
||||
$working_branch != "$PROD_BRANCH" ]]; then
|
||||
echo "> Abort: Please run on the default, release or patch branch."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -101,14 +101,16 @@ check() {
|
||||
_check_node_packages
|
||||
}
|
||||
|
||||
# auto-generate a new version number to the file 'package.json' and
|
||||
# Auto-generate a new version number to the file 'package.json'
|
||||
bump_node() {
|
||||
bump="standard-version -i $CHANGE_LOG"
|
||||
|
||||
if $opt_pre; then
|
||||
standard-version -i "$CHANGE_LOG" -p rc
|
||||
else
|
||||
standard-version -i "$CHANGE_LOG"
|
||||
bump="$bump -p rc"
|
||||
fi
|
||||
|
||||
eval "$bump"
|
||||
|
||||
# Change heading of Patch version to heading level 2 (a bug from `standard-version`)
|
||||
sed -i "s/^### \[/## \[/g" "$CHANGE_LOG"
|
||||
# Replace multiple empty lines with a single empty line
|
||||
@@ -117,29 +119,34 @@ bump_node() {
|
||||
|
||||
## Bump new version to gem config file
|
||||
bump_gem() {
|
||||
sed -i "s/[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/$1/" "$GEM_SPEC"
|
||||
_ver="$1"
|
||||
|
||||
if $opt_pre; then
|
||||
_ver="${1/-/.}"
|
||||
fi
|
||||
|
||||
sed -i "s/[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/$_ver/" "$GEM_SPEC"
|
||||
}
|
||||
|
||||
# Update the git branches, create a new tag, and then build the gem package.
|
||||
release() {
|
||||
# Creates a new tag on the production branch with the given version number.
|
||||
# Also commits the changes and merges the production branch into the default branch.
|
||||
branch() {
|
||||
_version="$1" # X.Y.Z
|
||||
_latest_commit="$(git rev-parse HEAD)"
|
||||
|
||||
git add .
|
||||
git commit -m "chore(release): $_version"
|
||||
|
||||
# Create a new tag on production branch
|
||||
echo -e "> Create tag v$_version\n"
|
||||
git tag "v$_version"
|
||||
|
||||
git checkout "$STAGING_BRANCH"
|
||||
git checkout "$DEFAULT_BRANCH"
|
||||
git merge --no-ff --no-edit "$PROD_BRANCH"
|
||||
|
||||
if [[ $working_branch == hotfix/* ]]; then
|
||||
git merge --no-ff --no-edit "$working_branch"
|
||||
# delete the patch branch
|
||||
git branch -D "$working_branch"
|
||||
fi
|
||||
|
||||
# cherry-pick the latest commit from production branch to default branch
|
||||
git cherry-pick "$_latest_commit"
|
||||
|
||||
}
|
||||
|
||||
## Build a gem package
|
||||
@@ -164,7 +171,7 @@ build_gem() {
|
||||
main() {
|
||||
check
|
||||
|
||||
if [[ $opt_pre = false ]]; then
|
||||
if [[ $opt_pre = false && $working_branch != "$PROD_BRANCH" ]]; then
|
||||
git checkout "$PROD_BRANCH"
|
||||
git merge --no-ff --no-edit "$working_branch"
|
||||
fi
|
||||
@@ -175,16 +182,12 @@ main() {
|
||||
|
||||
bump_gem "$_version"
|
||||
|
||||
echo -e "> Build the gem package for v$_version\n"
|
||||
|
||||
if [[ $opt_pre = false ]]; then
|
||||
echo -e "> Bumped version number to $_version\n"
|
||||
git add .
|
||||
git commit -m "chore(release): $_version"
|
||||
|
||||
release "$_version"
|
||||
branch "$_version"
|
||||
fi
|
||||
|
||||
echo -e "> Build the gem package for v$_version\n"
|
||||
|
||||
build_gem
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user