Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bestZwei/blog
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/cd.yml
#	.github/workflows/ci.yml
#	.github/workflows/commitlint.yml
#	.github/workflows/publish.yml
#	.github/workflows/stale.yml
#	.github/workflows/style-lint.yml
  • Loading branch information
developer committed Nov 9, 2024
2 parents b70b3a4 + d51345e commit 00423dd
Show file tree
Hide file tree
Showing 31 changed files with 806 additions and 131 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CD

on:
push:
branches: [production]
tags-ignore: ["**"]

jobs:
release:
if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }}
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true

- uses: actions/setup-node@v4
with:
node-version: lts/*

- run: npm install
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}

publish:
needs: release
uses: ./.github/workflows/publish.yml
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
BUILDER: ${{ secrets.BUILDER }}
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches:
- master
- "hotfix/*"
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- .gitignore
- "docs/**"
- README.md
- LICENSE
pull_request:
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- .gitignore
- "docs/**"
- README.md
- LICENSE

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ["3.1", "3.2", "3.3"]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # for posts's lastmod

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Build Assets
run: npm i && npm run build

- name: Test Site
run: bash tools/test.sh
15 changes: 15 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint Commit Messages

on:
push:
branches:
- master
- "hotfix/*"
pull_request:

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wagoid/commitlint-github-action@v6
25 changes: 25 additions & 0 deletions .github/workflows/pr-filter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Filter

on:
pull_request_target:
types: [opened, reopened]

jobs:
check-template:
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Check PR Content
id: intercept
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require('.github/workflows/scripts/pr-filter.js');
await script({ github, context, core });
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
push:
branches:
- docs
workflow_call:
secrets:
GH_PAT:
required: true
BUILDER:
required: true
workflow_dispatch:

jobs:
launch:
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}'
36 changes: 36 additions & 0 deletions .github/workflows/scripts/pr-filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
function hasTypes(markdown) {
return /## Type of change/.test(markdown) && /-\s\[x\]/i.test(markdown);
}

function hasDescription(markdown) {
return (
/## Description/.test(markdown) &&
!/## Description\s*\n\s*(##|\s*$)/.test(markdown)
);
}

module.exports = async ({ github, context, core }) => {
const pr = context.payload.pull_request;
const body = pr.body === null ? '' : pr.body;
const markdown = body.replace(/<!--[\s\S]*?-->/g, '');
const action = context.payload.action;

const isValid =
markdown !== '' && hasTypes(markdown) && hasDescription(markdown);

if (!isValid) {
await github.rest.pulls.update({
...context.repo,
pull_number: pr.number,
state: 'closed'
});

await github.rest.issues.createComment({
...context.repo,
issue_number: pr.number,
body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.`
});

core.setFailed('PR content does not meet template requirements.');
}
};
32 changes: 32 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Close stale issues and PRs"

on:
schedule:
- cron: "0 0 * * *" # every day at 00:00 UTC

permissions:
issues: write
pull-requests: write

env:
STALE_LABEL: inactive
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@v9
with:
# 60 days before marking issues/PRs stale
days-before-close: -1 # does not close automatically
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 }}
25 changes: 25 additions & 0 deletions .github/workflows/style-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Style Lint

on:
push:
branches:
- master
- "hotfix/*"
paths: ["_sass/**/*.scss"]
pull_request:
paths: ["_sass/**/*.scss"]

jobs:
stylelint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm i
- run: npm test
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo-data"
end

gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin]
27 changes: 20 additions & 7 deletions _data/locales/hu-HU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,23 @@ tabs:
categories: Kategóriák
tags: Címkék
archives: Archívum
about: Rólam
about: Bemutatkozás

# the text displayed in the search bar & search results
search:
hint: keresés
cancel: Mégse
no_results: Oops! Nincs találat a keresésre.
no_results: Hoppá! Nincs találat a keresésre.

panel:
lastmod: Legutóbb frissítve
trending_tags: Népszerű Címkék
toc: Tartalom
links: Blog linkek

copyright:
# Shown at the bottom of the post
license:
template: A bejegyzés :LICENSE_NAME licenccel rendelkezik.
template: A bejegyzést a szerző :LICENSE_NAME licenc alatt engedélyezte.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/

Expand All @@ -42,7 +41,7 @@ copyright:
Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek,
hacsak másképp nincs jelezve.
meta: Készítve :PLATFORM motorral :THEME témával
meta: Készítve :THEME témával a :PLATFORM platformra.

not_found:
statement: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat.
Expand Down Expand Up @@ -73,7 +72,21 @@ post:
title: Link másolása
succeed: Link sikeresen másolva!

# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: "%Y. %B. %e."
dayjs: "YYYY. MMMM D."
archives:
strftime: "%B"
dayjs: "MMM"

# categories page
categories:
category_measure: kategória
post_measure: bejegyzés
category_measure:
singular: kategória
plural: kategória
post_measure:
singular: bejegyzés
plural: bejegyzés
4 changes: 1 addition & 3 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
{%- endif -%}
</a>

<h1 class="site-title">
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</h1>
<a class="site-title d-block" href="{{ '/' | relative_url }}">{{ site.title }}</a>
<p class="site-subtitle fst-italic mb-0">{{ site.tagline }}</p>
</header>
<!-- .profile-wrapper -->
Expand Down
10 changes: 10 additions & 0 deletions _includes/toc-status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% comment %}
Determine TOC state and return it through variable "enable_toc"
{% endcomment %}

{% assign enable_toc = false %}
{% if site.toc and page.toc %}
{% if page.content contains '<h2' or page.content contains '<h3' %}
{% assign enable_toc = true %}
{% endif %}
{% endif %}
9 changes: 2 additions & 7 deletions _includes/toc.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{% assign enable_toc = false %}
{% if site.toc and page.toc %}
{% if page.content contains '<h2' or page.content contains '<h3' %}
{% assign enable_toc = true %}
{% endif %}
{% endif %}
{% include toc-status.html %}

{% if enable_toc %}
<section id="toc-wrapper" class="d-none ps-0 pe-4">
<section id="toc-wrapper" class="ps-0 pe-4">
<h2 class="panel-heading ps-3 mb-2">{{- site.data.locales[include.lang].panel.toc -}}</h2>
<nav id="toc"></nav>
</section>
Expand Down
23 changes: 9 additions & 14 deletions _javascript/modules/components/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@
* Expand or close the sidebar in mobile screens.
*/

const ATTR_DISPLAY = 'sidebar-display';
const $sidebar = document.getElementById('sidebar');
const $trigger = document.getElementById('sidebar-trigger');
const $mask = document.getElementById('mask');

class SidebarUtil {
static isExpanded = false;
static #isExpanded = false;

static toggle() {
if (SidebarUtil.isExpanded === false) {
document.body.setAttribute(ATTR_DISPLAY, '');
} else {
document.body.removeAttribute(ATTR_DISPLAY);
}

SidebarUtil.isExpanded = !SidebarUtil.isExpanded;
this.#isExpanded = !this.#isExpanded;
document.body.toggleAttribute('sidebar-display', this.#isExpanded);
$sidebar.classList.toggle('z-2', this.#isExpanded);
$mask.classList.toggle('d-none', !this.#isExpanded);
}
}

export function sidebarExpand() {
document
.getElementById('sidebar-trigger')
.addEventListener('click', SidebarUtil.toggle);

document.getElementById('mask').addEventListener('click', SidebarUtil.toggle);
$trigger.onclick = $mask.onclick = () => SidebarUtil.toggle();
}
Loading

0 comments on commit 00423dd

Please sign in to comment.