From 6bbe686415f4d66af3e6c3303c05f4fc660bd88a Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 15:59:25 +0100 Subject: [PATCH 1/7] test CI workflow --- .gitea/workflows/hugo.yaml | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .gitea/workflows/hugo.yaml diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml new file mode 100644 index 0000000..14df923 --- /dev/null +++ b/.gitea/workflows/hugo.yaml @@ -0,0 +1,57 @@ +name: Website build and deploy + +on: + push: + # branches: + # - main # Deploy branch + + # Run on PRs, but only build + pull_request: + # Allows 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 + pages: write + id-token: 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 + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout with submodules + uses: actions/checkout@v4 + with: + submodules: recursive # Get submdules + fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2.6.0 + with: + hugo-version: "latest" + extended: true + + - name: Build website with Hugo + run: hugo + + # - name: Copy website to host + # uses: appleboy/scp-action@v0.1.7 + # with: + # host: fewo-casa-maria.de + # username: fewocm + # key: ${{ secrets.SSH_KEY }} + # port: 22 + # timeout: 1m + # command_timeout: 2m + # target: "/var/www/virtual/fewocm/beta.fewo-casa-maria.de/" + # source: "public/*" + # rm: true + # strip_components: 1 -- 2.36.6 From 49a547e7095de9b38549035e4649b09b14dd7d4c Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 16:01:15 +0100 Subject: [PATCH 2/7] fix action origin --- .gitea/workflows/hugo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index 14df923..291a340 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -34,7 +34,7 @@ jobs: fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod - name: Setup Hugo - uses: peaceiris/actions-hugo@v2.6.0 + uses: github.com/peaceiris/actions-hugo@v2.6.0 with: hugo-version: "latest" extended: true -- 2.36.6 From 3f4eb21d0ba5120f704ce36effdd0c7490a3f817 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 16:01:48 +0100 Subject: [PATCH 3/7] fix action origin 2 --- .gitea/workflows/hugo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index 291a340..228a429 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -34,7 +34,7 @@ jobs: fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod - name: Setup Hugo - uses: github.com/peaceiris/actions-hugo@v2.6.0 + uses: https://github.com/peaceiris/actions-hugo@v2.6.0 with: hugo-version: "latest" extended: true -- 2.36.6 From f976c3333268acda0c4d889b2965ba9b05ca0143 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 16:07:27 +0100 Subject: [PATCH 4/7] run deploy --- .gitea/workflows/hugo.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index 228a429..db55b4f 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -42,16 +42,16 @@ jobs: - name: Build website with Hugo run: hugo - # - name: Copy website to host - # uses: appleboy/scp-action@v0.1.7 - # with: - # host: fewo-casa-maria.de - # username: fewocm - # key: ${{ secrets.SSH_KEY }} - # port: 22 - # timeout: 1m - # command_timeout: 2m - # target: "/var/www/virtual/fewocm/beta.fewo-casa-maria.de/" - # source: "public/*" - # rm: true - # strip_components: 1 + - name: Copy website to host + uses: https://github.com/appleboy/scp-action@v0.1.7 + with: + host: mehl.mx + username: maxmehl + key: ${{ secrets.SSH_KEY }} + port: 22 + timeout: 1m + command_timeout: 2m + target: "/var/www/virtual/maxmehl/html/" + source: "public/*" + rm: true + strip_components: 1 -- 2.36.6 From 59ea1238d9e5ee24fd6cb1a35057efe101a87c9e Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 16:23:02 +0100 Subject: [PATCH 5/7] fix matomo proxy config --- .gitea/workflows/hugo.yaml | 7 +++++++ themes/hugo-sustain/static/config.php.sample | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index db55b4f..299739c 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -33,6 +33,13 @@ jobs: submodules: recursive # Get submdules fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod + - name: Create configuration for Matomo + run: | + cp themes/hugo-sustain/static/config.php.sample static/config.php + sed -i "s|__PIWIK_URL__|${{ secrets.MATOMO_PIWIK_URL }}|" static/config.php + sed -i "s|__PROXY_URL__|${{ secrets.MATOMO_PROXY_URL }}|" static/config.php + sed -i "s|__TOKEN_AUTH__|${{ secrets.MATOMO_TOKEN_AUTH }}|" static/config.php + - name: Setup Hugo uses: https://github.com/peaceiris/actions-hugo@v2.6.0 with: diff --git a/themes/hugo-sustain/static/config.php.sample b/themes/hugo-sustain/static/config.php.sample index 9a210a9..c332697 100644 --- a/themes/hugo-sustain/static/config.php.sample +++ b/themes/hugo-sustain/static/config.php.sample @@ -8,16 +8,16 @@ // Edit the line below, and replace http://your-matomo-domain.example.org/matomo/ // with your Matomo URL ending with a slash. // This URL will never be revealed to visitors or search engines. -$PIWIK_URL = 'http://your-matomo-domain.example.org/matomo/'; +$PIWIK_URL = '__PIWIK_URL__'; // Edit the line below and replace http://your-tracker-proxy.org/ with the URL to your tracker-proxy // setup. This URL will be used in Matomo output that contains the Matomo URL, so your Matomo is effectively // hidden. -$PROXY_URL = 'http://your-tracker-proxy.org/'; +$PROXY_URL = '__PROXY_URL__'; // Edit the line below, and replace xyz by the token_auth for the user "UserTrackingAPI" // which you created when you followed instructions above. -$TOKEN_AUTH = 'xyz'; +$TOKEN_AUTH = '__TOKEN_AUTH__'; // Maximum time, in seconds, to wait for the Matomo server to return the 1*1 GIF $timeout = 5; @@ -29,7 +29,7 @@ $user_agent = ''; // In some situations the backend takes the sending IP address into account // which by default is the IP address of the server/service proxy.php is executed from. // If $http_forward_header is set, the clients IP address is sent over in the -// header field with the given name. An empty string means do not send the header. +// header field with the given name. An empty string means do not send the header. // A common header name is 'X-Forwarded-For'. // // In order to work, the http server serving the matomo instance, has to be configured -- 2.36.6 From b90ef3b12f9b8e18ba981bb8bbc4e0ed3beca2f5 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 16:25:05 +0100 Subject: [PATCH 6/7] fix branches --- .gitea/workflows/hugo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index 299739c..fddcb54 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -2,8 +2,8 @@ name: Website build and deploy on: push: - # branches: - # - main # Deploy branch + branches: + - main # Deploy branch # Run on PRs, but only build pull_request: -- 2.36.6 From 1299fd323d3b6c2afd967b030c2a7ead268f53a5 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Wed, 10 Jan 2024 16:30:51 +0100 Subject: [PATCH 7/7] only deploy when on main --- .gitea/workflows/hugo.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/hugo.yaml b/.gitea/workflows/hugo.yaml index fddcb54..27f87a0 100644 --- a/.gitea/workflows/hugo.yaml +++ b/.gitea/workflows/hugo.yaml @@ -62,3 +62,4 @@ jobs: source: "public/*" rm: true strip_components: 1 + if: gitea.ref == 'refs/heads/main' -- 2.36.6