summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2022-04-14 15:58:07 -0400
committerLuke Smith <luke@lukesmith.xyz>2022-04-14 15:58:07 -0400
commitc08fd719fe95604d245f3eb0d18b5b0c72c1308d (patch)
tree9b5199ebd42684f266b4918cd6191f50db98239a /.github
parent1477b62cc47dd937688771a825dd9fd392aeaf25 (diff)
move to hugo
Diffstat (limited to '.github')
-rw-r--r--.github/pull_request_template.md12
-rw-r--r--.github/workflows/pr.yaml12
-rwxr-xr-x.github/workflows/scripts/check-files.sh153
-rw-r--r--.github/workflows/upload.yml33
4 files changed, 0 insertions, 210 deletions
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
deleted file mode 100644
index fb3b2f8..0000000
--- a/.github/pull_request_template.md
+++ /dev/null
@@ -1,12 +0,0 @@
-<!--
-- Recipes should be `.md` files in the `src/` directory. Look at already
- existing `.md` files for examples or see [example](example.md).
-- File names should be the name of the dish with words separated by hyphens
- (`-`). Not underscores, and definitely not spaces.
-- Recipe must be based, i.e. good traditional and substantial food. Nothing
- ironic, meme-tier hyper-sugary, meat-substitute, etc.
-- Be sure to add a small number of relevant tags to your recipe (and remove
- the dummy tags). Try to use already existing tags.
-- Don't include salt and pepper and other ubiquitous things in the ingredients
- list.
--->
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
deleted file mode 100644
index 785d40c..0000000
--- a/.github/workflows/pr.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-on: pull_request
-
-jobs:
- check_files:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 0
- - name: Check files for compliance
- run: .github/workflows/scripts/check-files.sh
-
diff --git a/.github/workflows/scripts/check-files.sh b/.github/workflows/scripts/check-files.sh
deleted file mode 100755
index 428649b..0000000
--- a/.github/workflows/scripts/check-files.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/sh
-set -eu
-
-SIZE_LIMIT=150000
-FAIL=0
-
-check_size() {
- size="$(stat --printf="%s" "$1")"
- if [ "$size" -gt "$SIZE_LIMIT" ]; then
- echo "File $1 is bigger than specified $SIZE_LIMIT limit"
- FAIL=1
- fi
-}
-
-check_file_name() {
- fileName="$1"
- expectedFolder="$2"
-
- shouldname="${expectedFolder}/$(basename "$fileName" |
- iconv --to-code=utf-8 |
- tr '[:upper:]' '[:lower:]' |
- tr '_ ' '-')"
-
- if [ "$shouldname" != "$fileName" ]; then
- echo "$1 should be named $shouldname."
- FAIL=1
- fi
-}
-
-check_webp_name() {
- check_file_name "$1" "data/pix"
-}
-
-check_recipe_name() {
- check_file_name "$1" "src"
-}
-
-check_recipe_content() {
- errMsgs="$(awk '
- BEGIN {
- HAS_TITLE = 0;
- HAS_TAGS = 0;
- HAS_INVALID_TAGS = 0;
- NUM_TAGS = 0;
- HAS_INGREDIENTS = 0;
- HAS_DIRECTIONS = 0;
- HAS_CONSECUTIVE_EMPTY_LINES = 0;
-
- CONSECUTIVE_EMPTY_LINES = 0;
- }
-
- # First line should be the title
- NR == 1 && /^# / {
- HAS_TITLE = 1;
- next;
- }
-
- $0 == "## Ingredients" {
- HAS_INGREDIENTS = 1;
- }
-
- $0 == "## Directions" {
- HAS_DIRECTIONS = 1;
- }
-
- $0 == "" {
- CONSECUTIVE_EMPTY_LINES++
- if (CONSECUTIVE_EMPTY_LINES >= 2) {
- HAS_CONSECUTIVE_EMPTY_LINES = 1;
- }
- }
-
- $0 != "" {
- CONSECUTIVE_EMPTY_LINES = 0;
- }
-
- END {
- # Last line should be the tags list
- if ($1 == ";tags:") {
- HAS_TAGS = 1;
- NUM_TAGS = NF - 1;
-
- # Loop through all the tags
- for (i = 2; i <= NF; i++) {
- # Make sure that each tag only contains lowercase letters and hyphens
- if ($i !~ "^[a-z-]+$") {
- HAS_INVALID_TAGS = 1;
- break;
- }
- }
- }
-
- if (!HAS_TITLE) {
- print "Recipe does not have a properly formatted title on the first line."
- }
-
- if (!HAS_TAGS) {
- print "Recipe does not have a properly formatted tags on the last line."
- } else {
- if (HAS_INVALID_TAGS) {
- print "Recipe has invalid tags. Tags must be separated by spaces and contain only lowercase letters or hyphens (-)";
- }
-
- if (NUM_TAGS < 2) {
- print "Recipe only has " NUM_TAGS " tags. Add some more."
- } else if (NUM_TAGS > 5) {
- print "Recipe has " NUM_TAGS " tags which is too many. Remove some tags."
- }
- }
-
- if (!HAS_INGREDIENTS) {
- print "Recipe does not have an ingredients list."
- }
-
- if (!HAS_DIRECTIONS) {
- print "Recipe does not have a directions section."
- }
-
- if (HAS_CONSECUTIVE_EMPTY_LINES) {
- print "Recipe has at least 2 consecutive empty lines.";
- }
- }
- ' "$1")"
-
- if [ -n "$errMsgs" ]; then
- echo "$errMsgs"
- FAIL=1
- fi
-}
-
-while IFS= read -r file; do
- echo "Checking '$file'"
- case "$file" in
- # Ignore these files
- index.md) ;;
- .github/*.md) ;;
-
- *.webp)
- check_size "$file"
- check_webp_name "$file"
- ;;
- *.md)
- check_recipe_name "$file"
- check_recipe_content "$file"
- ;;
- esac
- # Separate each file for easier reading.
- echo ""
-done <<EOF
-$(git diff --name-only "$(git merge-base origin/master HEAD)")
-EOF
-
-exit $FAIL
diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml
deleted file mode 100644
index 9fa59d6..0000000
--- a/.github/workflows/upload.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-name: CI
-
-# Controls when the action will run.
-on:
- # Triggers the workflow on push to master (including merged PRs)
- push:
- branches: [ master ]
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
- # This workflow contains a single job called "build"
- update:
- # The type of runner that the job will run on
- runs-on: ubuntu-latest
-
- # Steps represent a sequence of tasks that will be executed as part of the job
- steps:
- - name: Updating website.
- uses: appleboy/ssh-action@master
- with:
- host: based.cooking
- username: based
- key: ${{ secrets.based_ssh }}
- passphrase: ${{ secrets.based_ssh_pass }}
- port: ${{ secrets.based_port }}
- script: |
- cd repo
- git stash
- git pull --force origin master
- make deploy