Skip to content

Commit 8184d56

Browse files
authored
Initial commit
0 parents  commit 8184d56

28 files changed

+11384
-0
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: npm
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
commit-message:
13+
prefix: fix
14+
include: scope
15+
versioning-strategy: increase

.github/workflows/auto-merge.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Source: https://nicolasiensen.github.io/2022-07-23-automating-dependency-updates-with-dependabot-github-auto-merge-and-github-actions/
2+
name: PR auto-merge
3+
on: pull_request_target
4+
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
9+
jobs:
10+
review-dependabot-pr:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
13+
steps:
14+
- name: Dependabot metadata
15+
id: metadata
16+
uses: dependabot/fetch-metadata@v2
17+
with:
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
20+
- name: Enable auto-merge for Dependabot PRs
21+
run: gh pr merge --auto --merge "$PR_URL"
22+
env:
23+
PR_URL: ${{github.event.pull_request.html_url}}
24+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
25+
26+
- name: Approve patch and minor updates
27+
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
28+
run: gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a patch or minor update**"
29+
env:
30+
PR_URL: ${{github.event.pull_request.html_url}}
31+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
32+
33+
- name: Comment on major updates of any dependencies
34+
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major'}}
35+
run: |
36+
gh pr comment $PR_URL --body "I'm **not approving** this PR because **it includes a major update of a dependency**"
37+
gh pr edit $PR_URL --add-label "requires-manual-qa"
38+
env:
39+
PR_URL: ${{github.event.pull_request.html_url}}
40+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
41+
42+
review-mod-update-pr:
43+
runs-on: ubuntu-latest
44+
if: ${{ github.event.pull_request.title == 'Update Hugo module dependencies' }}
45+
steps:
46+
- name: Enable auto-merge for mod-update PRs
47+
run: gh pr merge --auto --merge "$PR_URL"
48+
env:
49+
PR_URL: ${{github.event.pull_request.html_url}}
50+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/mod-update.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Update Hugo dependencies
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 3 * * *' # run daily at 03:00 AM
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
update-mod:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: lts/*
23+
cache: 'npm'
24+
cache-dependency-path: '**/package-lock.json'
25+
26+
- name: Perform clean install of npm
27+
run: npm ci
28+
29+
- name: Update Hugo module dependencies
30+
id: mod-updates
31+
run: |
32+
MOD_OUTPUT=$(npm run mod:update 2>&1)
33+
echo "$MOD_OUTPUT"
34+
MOD_UPDATES=$(echo "$MOD_OUTPUT" | grep '^go: upgraded' | sed 's/go: / - /' | sort -u)
35+
echo 'MOD_UPDATES<<EOF' >> $GITHUB_OUTPUT
36+
echo "$MOD_UPDATES" >> "$GITHUB_OUTPUT"
37+
echo 'EOF' >> $GITHUB_OUTPUT
38+
39+
- name: Create Pull Request
40+
uses: gethinode/create-pull-request@v7
41+
with:
42+
token: ${{ secrets.HUGO_MOD_PR }}
43+
commit-message: 'fix: update Hugo module dependencies'
44+
committer: GitHub <noreply@github.com>
45+
branch: hugo-mod-dependencies
46+
delete-branch: true
47+
title: 'Update Hugo module dependencies'
48+
body: |
49+
This PR is auto-generated by [create-pull-request][1].
50+
51+
Changes to go.mod:
52+
53+
${{ steps.mod-updates.outputs.MOD_UPDATES }}
54+
55+
[1]: https://github.com/peter-evans/create-pull-request
56+
labels: dependencies
57+
# Note: remove **/go.mod and **/go.sum if your repository does not have an exampleSite
58+
# or any other subfolder that uses Hugo modules
59+
add-paths: |
60+
go.mod
61+
go.sum
62+
**/go.mod
63+
**/go.sum

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
# TODO: uncomment
5+
# push:
6+
# branches:
7+
# - main
8+
9+
jobs:
10+
release:
11+
name: Create release
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
# Make sure the release step uses its own credentials
20+
persist-credentials: false
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: "lts/*"
26+
27+
- name: Perform clean install of npm
28+
run: npm ci
29+
30+
- name: Create release
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GIT }}
33+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
run: npx semantic-release

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
on:
3+
workflow_dispatch:
4+
# TODO: uncomment
5+
# push:
6+
# tags:
7+
# - v*
8+
# branches: [ main ]
9+
# pull_request:
10+
# branches: [ main ]
11+
12+
jobs:
13+
build:
14+
strategy:
15+
matrix:
16+
os: [macos-latest, windows-latest, ubuntu-latest]
17+
node-version: [20.x, 22.x]
18+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: ">1.0.0"
30+
31+
- name: Setup Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
cache: 'npm'
36+
cache-dependency-path: '**/package-lock.json'
37+
38+
- name: Perform clean install of npm
39+
run: npm ci
40+
41+
- name: Run tests
42+
run: npm run test

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/_vendor
2+
/public
3+
/resources
4+
node_modules/
5+
exampleSite/public
6+
exampleSite/resources
7+
8+
.DS_store
9+
.hugo_build.lock
10+
hugo_stats.json

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/install.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Skip Husky install in production and CI
2+
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
3+
process.exit(0)
4+
}
5+
const husky = (await import('husky')).default
6+
console.log(husky())

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm test

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Hinode Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)