Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ndonathan authored Nov 3, 2024
0 parents commit bfb5c7e
Show file tree
Hide file tree
Showing 39 changed files with 762 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 🐛 Issues
url: https://github.com/Chrede88/qubt/issues
about: Please report issues in the theme repo
1 change: 1 addition & 0 deletions .github/deploymentWorkflow/buildDeploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty placeholder
32 changes: 32 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
"commitMessagePrefix": "🤖",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "to {{newVersion}}",
"commitMessageSuffix": "",
"prConcurrentLimit": 0,
"prHourlyLimit": 0,
"reviewers": ["chrede88"],
"timezone": "Europe/Zurich",
"customManagers": [
{
"description": "Update Hugo/Go version in Github actions",
"customType": "regex",
"fileMatch": ["^.github/(?:workflows|actions)/.+\\.ya?ml$"],
"matchStrings": ["datasource=(?<datasource>.*?) depName=(?<depName>.*?)\n.*?'(?<currentValue>.*)'\n"],
"versioningTemplate": "semver-coerced",
"extractVersionTemplate": "^(v|go)?(?<version>.*)$"
}
],
"packageRules": [
{
"matchManagers": ["gomod"],
"matchDepTypes": ["indirect"],
"enabled": true
}
]
}
52 changes: 52 additions & 0 deletions .github/template-cleanup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# %NAME%

Please follow the instructions below to finish the setup of your new Qubt site.

## Installation

1) Add a LICENSE to your repo.
2) Clone your version of the template to your local computer:
```shell
git clone https://github.com/<username>/<reponame>
```
3) Modify `config/_default/hugo.yaml`, `config/_default/params.yaml` and `config/_default/menus.yaml` according to the configuration below.
4) Add your blog posts to `content/blog/`. See example posts for reference.
5) Modify `content/about.md` so it matches your preferences.
6) All images are stored in the `assets/` folder. You can group in subfolders if you like.
7) Build a local version of your site by executing `hugo server`. You can see the site by navigating to `localhost:1313` (actual URL will be outputted in the CLI) in a browser.
8) Add a new `icon.png` file to update the favicon. The png file should be 512px by 512px in size.

---

## Configuration

See the [wiki](https://github.com/chrede88/qubt/wiki) for all info about configuration.

---

## Update the Theme Version

The theme version used to build the site is defined in `go.mod` file.

The best practice is to update to released and tested versions. To update to a specific version execute the following command in a terminal/commandline (at the root path of your site repo):

```shell
hugo mod get github.com/Chrede88/[email protected]
```
Replace X,Y & Z with the corresponding version numbers. You can find the releases [here](https://github.com/Chrede88/qubt/releases). Please check if any breaking changes are listed under the release you want to update to, before proceeding.

---

## Deploy on Github Pages
You can very easily deploy your site using Github Pages. Included in this template is a Github Action workflow that will build and deploy your site to Github Pages automatically :+1:

You can find the workflow here `.github/deploymentWorkflow/buildDeploy.yml`. To use this, move it to `.github/workflows/`.

The workflow is already set up and ready to go, but go through it and spend some time to understand what's going on. Otherwise, it'll always be this black box of magic that you can't fix when it breaks!

Last step: Go to Settings -> Pages -> Build and deployment -> Set the Source to "Github Actions".

Next time you publish a release this workflow will build and deploy your site :tada:

Your site will be published to the following URL:
`https://%USER%.github.io/%NAME%`
15 changes: 15 additions & 0 deletions .github/template-cleanup/config/hugo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
############################
## CHANGE THESE
############################

baseURL: "https://%USER%.github.io/%NAME%"
title: %NAME%

############################
## MISC
############################

enableEmoji: true
disableKinds: ["taxonomy", "term"]
languageCode: "en-us"
enableRobotsTXT: true
70 changes: 70 additions & 0 deletions .github/template-cleanup/config/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
############################
## Author
############################

author:
name: %USER%
image: author.png
greeting: "Your new Qubt site :tada:"
icon: ":wave:"

############################
## Links
############################

links:
- github: https://github.com/%USER%/%NAME%
- link: https://github.com/%USER%/%NAME%#readme
# - website:
# - x-twitter:
# - mastodon:
# - linkedin:
# - instagram:
# - reddit:
# - telegram:
# - whatsapp:
# - signal:
# - codepen:
# - dev:
# - email:
# - discord:
# - orcid:
# - slack:
# - stack-overflow:
# - twitch:
# - patreon:
# - soundcloud:
# - dribbble:
# - stack-exchange:
# - tiktok:
# - youtube:
# - keybase:
# - flickr:
# - tumblr:
# - kickstarter:
# - snapchat:
# - bluesky:
# - bitbucket:
# - bandcamp:
# - etsy:
# - spotify:
# - pinterest:
# - strava:
# - untappd:
# - skype:
# - medium:
# - foursquare:
# - apple:
# - amazon:
# - google:
# - paypal:
# - windows:

###############################
## OpenGraph & Twitter Cards
###############################

title: %NAME%
description: "Site build with Qubt & Hugo"
images:
- thumbnail.png
12 changes: 12 additions & 0 deletions .github/template-cleanup/content/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# don't change
type: misc

# change these
jobTitle: Blogger
name: %USER%
bio: true
icon: ":coffee:"
---

Add your Bio here!:+1:
5 changes: 5 additions & 0 deletions .github/template-cleanup/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/%USER%/%NAME%

go 1.22.2

require github.com/chrede88/qubt v1.4.0 // indirect
85 changes: 85 additions & 0 deletions .github/workflows/buildDeploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
# Go to Settings -> Pages -> Build and deployment -> Set the Source to "Github Actions".
name: Build & Deploy Hugo site to Pages

# Will fire when a new release is published
on:
release:
types: [published]

# Change the above to this if you want to build and deploy on every push, but
# be mindful of overuse. Free accounts have a limited amount of
# compute time per month.
# on:
# push:
# branches:
# - main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
id-token: write
pages: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build: # name of the job. We are conditioning the next job (deploy) on the succes of this one.
runs-on: ubuntu-latest # runner
steps:
# Checkout the main branch so the action has access to the files
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

# Setup Go. Remember to keep the version up to date with your local build environment
- name: Setup Go
uses: actions/setup-go@v5
with:
# renovate: datasource=github-tags depName=golang/go
go-version: '1.23.2'

# Setup Hugo. Remember to keep the version up to date with your local build environment
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
# renovate: datasource=github-releases depName=gohugoio/hugo
hugo-version: '0.136.5'
extended: true

# Build your site and dump the files in ./public
- name: Build
run: hugo --minify

# Upload the files outputtet files so the next job can get to them
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public

# Deployment job. Now let's deploy the site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }} # https://<username>.github.io/<repo>
runs-on: ubuntu-latest # runner
needs: build # only do this if the build was succesfull
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
78 changes: 78 additions & 0 deletions .github/workflows/cleanTemplate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Clean Template

on:
# run when branch created (repo generated from template)
create:

# only keep latest run of this workflow
concurrency:
group: first-time-setup
cancel-in-progress: false

# ADDED THIS CHANGE
permissions:
actions: write
checks: write
contents: write


jobs:
first-time-setup:
# ensure run only once, when repo generated
if: github.run_number == 1

runs-on: ubuntu-latest

steps:
# get main branch repo contents
- name: Checkout code
uses: actions/checkout@v4

# remove files not needed for user instance of template
- name: Remove unneeded files
run: |
# Prepare variables
NAME="${GITHUB_REPOSITORY##*/}"
USER=$GITHUB_REPOSITORY_OWNER
# update placeholders
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/README.md
sed -i "s/%USER%/$USER/g" .github/template-cleanup/README.md
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/config/hugo.yaml
sed -i "s/%USER%/$USER/g" .github/template-cleanup/config/hugo.yaml
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/config/params.yaml
sed -i "s/%USER%/$USER/g" .github/template-cleanup/config/params.yaml
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/go.mod
sed -i "s/%USER%/$USER/g" .github/template-cleanup/go.mod
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/content/about.md
sed -i "s/%USER%/$USER/g" .github/template-cleanup/content/about.md
# replace files
cp -R .github/template-cleanup/README.md .
cp -R .github/template-cleanup/config/* config/_default/
cp -R .github/template-cleanup/go.mod .
cp -R .github/template-cleanup/content/* content/
# move files
mv -f .github/workflows/buildDeploy.yaml .github/deploymentWorkflow/buildDeploy.yaml
# download new author and thumbnail images
wget -O assets/author.png https://github.com/$USER.png
wget -O assets/thumbnail.png https://github.com/$USER.png
# remove files
rm -rf \
.github/ISSUE_TEMPLATE/ \
.github/workflows/ \
.github/template-cleanup/ \
.github/renovate.json \
go.sum \
LICENSE \
assets/author.jpeg \
assets/thumbnail.jpeg
# save changed files
- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Setup and populate your repo"
Loading

0 comments on commit bfb5c7e

Please sign in to comment.