diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d236830 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "yaml.schemas": { + "https://raw.githubusercontent.com/woodpecker-ci/woodpecker/master/pipeline/schema/schema.json": "file:///home/laura/git/lila-network-website/static/.woodpecker/deploy.yml" + } +} \ No newline at end of file diff --git a/.woodpecker/deploy.yml b/.woodpecker/deploy.yml new file mode 100644 index 0000000..e9a98b3 --- /dev/null +++ b/.woodpecker/deploy.yml @@ -0,0 +1,58 @@ +# hugo.yml +# +# Takes a repository with Hugo source, generates the static site and +# pushes the result to Codeberg pages +# +# Needs a codeberg access token (codeberg_token) as a secret in Woodpecker config +# Also uses another secret (mail) with email address for git config +# +# .domains file in the repository is copied to the output branch so custom domains work +# +# The HUGO_OUTPUT variable must be set to the build output folder configured in Hugo +# + +# Exclude page pipeline to be run on "pages" branch +when: + branch: + exclude: pages + +# Recursive cloning is used to fully clone the themes given as Git submodules +clone: + git: + image: woodpeckerci/plugin-git + settings: + recursive: true + +steps: + # Build hugo static files + build: + image: golang:1.20-bookworm + commands: + - wget https://github.com/gohugoio/hugo/releases/download/v0.116.0/hugo_extended_0.116.0_linux-amd64.deb && apt install ./hugo_extended_0.116.0_linux-amd64.deb && rm -f hugo_extended_0.116.0_linux-amd64.deb + - hugo --minify --destination ./hugo_public + when: + event: [ pull_request, push ] + + publish: + image: bitnami/git + # Must be set in Woodpecker configuration + secrets: + - codeberg_token + environment: + DEST_REPONAME: dest_repo + commands: + # Git configuration + - git config --global user.email noreply@example.com + - git config --global user.name "Woodpecker CI" + - git clone -b pages https://$CODEBERG_TOKEN@codeberg.org/lila-network/pages.git $DEST_REPONAME + # Copy build step output to repository folder + - cp -ar ./hugo_public/. $DEST_REPONAME/ + # Needed for custom domains + - cp .domains $DEST_REPONAME || true # Ignore if it doesn't exist + # Commit and push all static files with pipeline started timestamp + - cd $DEST_REPONAME + - git add . + - git commit -m "Woodpecker CI ${CI_BUILD_CREATED}" + - git push + when: + event: push diff --git a/hugo.yaml b/hugo.yaml index 1b16374..41f7da1 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -54,4 +54,4 @@ author: module: hugoVersion: extended: false - min: 0.86.1 + min: "v0.86.1"