Skip to content

Commit

Permalink
Fix theme directory
Browse files Browse the repository at this point in the history
  • Loading branch information
matt0x6F committed Apr 21, 2024
1 parent 1a48778 commit 224d5f9
Show file tree
Hide file tree
Showing 563 changed files with 45,020 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/themes/hugo-theme-relearn/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

[*.css]
indent_size = 4

[*.js]
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
43 changes: 43 additions & 0 deletions docs/themes/hugo-theme-relearn/.githooks/pre-push.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3

# This script avoids to push branches starting with a "#". This is the way
# how I store ticket related feature branches that are work in progress.

# Once a feature branch is finished, it will be rebased to mains HEAD,
# its commits squashed, merged into main and the branch deleted afterwards.

# Call this script from your ".git/hooks/pre-push" file like this (supporting
# Linux, Windows and MacOS)

# #!/bin/sh
# echo 'execute .githooks/pre-push.py' >> .githooks/hooks.log
# python3 .githooks/pre-push.py

from datetime import datetime
import re
import subprocess

# This hook is called with the following parameters:
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
# If pushing without using a named remote, those arguments will be equal.

# Information about the commits being pushed is supplied as lines to
# the standard input in the form:
# <local ref> <local sha1> <remote ref> <remote sha1>
# This hook prevents the push of commits that belong to branches starting with
# an "#" (which are work in progress).

def main():
time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
local_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], universal_newlines=True).strip()
wip_prefix = '^#\\d+(?:\\b.*)$'
if re.match(wip_prefix, local_branch):
print(f'{time}: Branch "{local_branch}" was not pushed because its name starts with a "#" which marks it as work in progress', file=open(".githooks/hooks.log", "a"))
print(f'Branch "{local_branch}" was not pushed because its name starts with a "#" which marks it as work in progress')
exit(1)
print(f'{time}: Branch "{local_branch}" was pushed', file=open(".githooks/hooks.log", "a"))
exit(0)

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions docs/themes/hugo-theme-relearn/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [McShelby]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build site
description: Builds the Hugo exampleSite for later deploy on GitHub-Pages
runs:
using: composite
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'

- name: Build site
shell: bash
run: |
hugo --source ${GITHUB_WORKSPACE}/exampleSite --destination ${GITHUB_WORKSPACE}/../public --cleanDestinationDir --environment github --theme ${GITHUB_WORKSPACE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Check milestone
description: Checks if the given milestone and its according tag are valid to be released
inputs:
milestone:
description: Milestone for this release
required: true
github_token:
description: Secret GitHub token
required: true
outputs:
outcome:
description: Result of the check, success or failure
value: ${{ steps.outcome.outputs.outcome }}
runs:
using: composite
steps:
- name: Get closed issues for milestone
id: closed_issues
uses: octokit/[email protected]
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
query: |
query {
search(first: 1, type: ISSUE, query: "user:${{ github.repository_owner }} repo:${{ github.event.repository.name }} milestone:${{ env.MILESTONE }} state:closed") {
issueCount
}
}
- name: Get open issues for milestone
id: open_issues
uses: octokit/[email protected]
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
query: |
query {
search(first: 1, type: ISSUE, query: "user:${{ github.repository_owner }} repo:${{ github.event.repository.name }} milestone:${{ env.MILESTONE }} state:open") {
issueCount
}
}
- name: Get old version number
id: oldvers
uses: andstor/file-reader-action@v1
with:
path: layouts/partials/version.txt

- name: Get old main version number
id: oldmainvers
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.oldvers.outputs.contents }}
regex: (\d+)\.(\d+)\.\d+.*
replacement: '$1\.$2'

- name: Get current patch version number
id: patchvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: \d+\.\d+\.(\d+)
replacement: "$1"

- name: Get migration notes
id: migrationnotes
uses: andstor/file-reader-action@v1
with:
path: exampleSite/content/basics/migration/_index.en.md

- name: Check for old migration notes
id: hasoldnotes
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.migrationnotes.outputs.contents }}
regex: '.*?[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*-*\s*[\n\r\s]*?[\n\r]+##\s+${{ steps.oldmainvers.outputs.value }}\.0\s+.*?[\n\r][\n\r\s]*.*'
flags: gs
replacement: '1'

- name: Set outcome
id: outcome
shell: bash
run: |
if [ "${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 && fromJSON(steps.open_issues.outputs.data).search.issueCount == 0 && ( (steps.patchvers.outputs.value!='0'&&steps.hasoldnotes.outputs.value=='1') || (steps.patchvers.outputs.value=='0'&&steps.hasoldnotes.outputs.value!='1') ) }}" = "true" ]; then
echo "outcome=success" >> $GITHUB_OUTPUT
else
echo "outcome=failure" >> $GITHUB_OUTPUT
fi
- name: Log results and exit
shell: bash
run: |
echo outcome : ${{ steps.outcome.outputs.outcome }}
echo has closed issues : ${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 }}
echo has open issues : ${{ fromJSON(steps.open_issues.outputs.data).search.issueCount > 0 }}
echo is patch version : ${{ steps.patchvers.outputs.value != '0' }}
echo has old main notes : ${{ steps.hasoldnotes.outputs.value == '1' }}
echo are notes okay : ${{ (steps.patchvers.outputs.value!='0'&&steps.hasoldnotes.outputs.value=='1') || (steps.patchvers.outputs.value=='0'&&steps.hasoldnotes.outputs.value!='1') }}
if [ "${{ steps.outcome.outputs.outcome }}" = "failure" ]; then
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy site
description: Deploys a built site on GitHub-Pages
inputs:
github_token:
description: Secret GitHub token
required: true
runs:
using: composite
steps:
- name: Deploy site
uses: peaceiris/actions-gh-pages@v3
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_WORKSPACE: ${{ github.workspace }}
with:
github_token: ${{ env.GITHUB_TOKEN }}
publish_dir: ${{ env.GITHUB_WORKSPACE }}/../public
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Release milestone
description: Creates a release and tag out of a given milestone
inputs:
milestone:
description: Milestone for this release
required: true
github_token:
description: Secret GitHub token
required: true
runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Setup git
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Get current date
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: 'YYYY-MM-DD'

- name: Get current main version number
id: mainvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+\.\d+)\.\d+
replacement: "$1"

- name: Get current main version number for anchoring
id: mainanchor
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+)\.(\d+)\.\d+
replacement: "$1$2"

- name: Get current major version number
id: majorvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+)\.\d+\.\d+
replacement: "$1"

- name: Get next version number
id: nextvers
uses: WyriHaximus/github-action-next-semvers@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
version: ${{ env.MILESTONE }}

- name: Close milestone
uses: Akkjon/[email protected]
continue-on-error: true
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
milestone_name: ${{ env.MILESTONE }}

- name: Create temporary tag
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
git tag --message "" "$MILESTONE" || true
git push origin "$MILESTONE" || true
git tag --force --message "" "$MILESTONE"
git push --force origin "$MILESTONE"
- name: Update migration docs
uses: mingjun97/file-regex-replace@v1
with:
regex: '(.)[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*-*\s*[\n\r\s]*?[\n\r]+##\s*.*?[\n\r][\n\r\s]*(.)'
replacement: "$1\n\n<!--GH-ACTION-RELEASE-MILESTONE-->\n\n---\n\n## ${{ steps.mainvers.outputs.value }}.0 (${{ steps.date.outputs.time }}) {#${{ steps.mainanchor.outputs.value }}0}\n\n$2"
include: exampleSite/content/basics/migration/_index.en.md

- name: Update generator version
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
run: |
echo -n "$MILESTONE" > layouts/partials/version.txt
- name: Update changelog
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GREN_GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
npx [email protected] changelog --generate --override --tags=all
- name: Commit updates
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
GREN_GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
git add *
git commit --message "Ship tag $MILESTONE"
git push origin main
- name: Create final tag
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
MILESTONE_MINOR: ${{ steps.mainvers.outputs.value }}
MILESTONE_MAJOR: ${{ steps.majorvers.outputs.value }}
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
git tag --force --message "" "$MILESTONE"
git push --force origin "$MILESTONE"
git tag --message "" "$MILESTONE_MINOR.x" || true
git push origin "$MILESTONE_MINOR.x" || true
git tag --force --message "" "$MILESTONE_MINOR.x"
git push --force origin "$MILESTONE_MINOR.x"
git tag --message "" "$MILESTONE_MAJOR.x" || true
git push origin "$MILESTONE_MAJOR.x" || true
git tag --force --message "" "$MILESTONE_MAJOR.x"
git push --force origin "$MILESTONE_MAJOR.x"
git tag --message "" "x" || true
git push origin "x" || true
git tag --force --message "" "x"
git push --force origin "x"
- name: Publish release
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GREN_GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
npx [email protected] release --tags "$MILESTONE"
- name: Update version number to mark non-release version
shell: bash
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
echo -n "$MILESTONE+tip" > layouts/partials/version.txt
git add *
git commit --message "Mark non-release version"
git push origin main
- name: Create next patch milestone
uses: WyriHaximus/github-action-create-milestone@v1
continue-on-error: true
env:
MILESTONE: ${{ inputs.milestone }}
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
title: ${{ steps.nextvers.outputs.patch }}
Loading

0 comments on commit 224d5f9

Please sign in to comment.