From c526889e3caf19135ccbd4cc98bc7327108c4fff Mon Sep 17 00:00:00 2001 From: Stephan Hadan Date: Wed, 29 Jan 2025 09:54:43 +0100 Subject: [PATCH] added first running prototype --- .forgejo/workflows/deploy.yml | 39 +++++++++++++++++++++++++++++++++++ .gitignore | 15 ++++++++++++++ .gitmodules | 3 +++ LICENSE | 23 +++++++++++++++++++++ hugo.toml | 4 ++++ themes/internet-weblog | 1 + 6 files changed, 85 insertions(+) create mode 100644 .forgejo/workflows/deploy.yml create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 LICENSE create mode 100644 hugo.toml create mode 160000 themes/internet-weblog diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..c200d8a --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,39 @@ +name: Build,test and deploy hugo-internet-weblog-demo +run-name: ${{ gitea.actor }} is building, testing and deploying the static page +on: + push: + branches: + - main + +jobs: + deploy-prod: + runs-on: ubuntu-latest + steps: + - run: echo "The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Install apt packages + run: apt update && apt install -y jq rsync + - name: Get latest Hugo version + run: | + url=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/releases/latest" | jq -r '.assets[] | select(.name | contains("linux-amd64.tar.gz")) | .browser_download_url' | grep -E 'hugo_[0-9]+\.[0-9]+\.[0-9]+_linux-amd64.tar.gz') + wget -P /tmp/hugo/ "$url" + version=$(echo "$url" | grep -oP 'hugo_\K[0-9]+\.[0-9]+\.[0-9]+') + echo "Downloaded Hugo version: $version" + - name: Unpack Hugo + run: tar -xf /tmp/hugo/* -C ${{ gitea.workspace }}/bin + - name: Build the static webpage + run: ${{ gitea.workspace }}/bin/hugo --minify + - name: Test static page + run: bash ${{ gitea.workspace }}/bin/test_static_page.sh + - name: Create private key + run: | + echo "${{ secrets.ACT_RUNNER_KEY }}" > /tmp/act_runner_key + chmod 600 /tmp/act_runner_key + - name: rsync public directory + run: | + /usr/bin/rsync -avz --delete -e "ssh -i /tmp/act_runner_key -o StrictHostKeyChecking=no" ${{ gitea.workspace }}/public/* root@vps03.hadan-it.com:/data/webspace/preview.hadan-it.com/hugo-internet-weblog-demo/ + - run: echo "This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c79a77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.DS_Store + +# Generated files by hugo +/public/ +/resources/_gen/ +/assets/jsconfig.json +hugo_stats.json + +# Executable may be added to repository +hugo.exe +hugo.darwin +hugo.linux + +# Temporary lock file while building +/.hugo_build.lock diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8982cc4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "themes/internet-weblog"] + path = themes/internet-weblog + url = https://git.hadan-it.com/stiebke/hugo-internet-weblog.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..417373e --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2025 Stephan Hadan + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..e9f1fdf --- /dev/null +++ b/hugo.toml @@ -0,0 +1,4 @@ +baseURL = 'https://preview.hadan-it.com/hugo-internet-weblog-demo/' +languageCode = 'de' +title = 'demo' +theme = 'internet-weblog' diff --git a/themes/internet-weblog b/themes/internet-weblog new file mode 160000 index 0000000..fd92062 --- /dev/null +++ b/themes/internet-weblog @@ -0,0 +1 @@ +Subproject commit fd92062e804e8af0818ffd013efc53bef8e4fd66