Setup deployment via CI #2
65
.gitea/workflows/hugo.yaml
Normal file
65
.gitea/workflows/hugo.yaml
Normal file
@@ -0,0 +1,65 @@
|
||||
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: 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:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
|
||||
- name: Build website with Hugo
|
||||
run: hugo
|
||||
|
||||
- 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
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user