From bd20f2903fca025eed8f68e7db5de1470924f251 Mon Sep 17 00:00:00 2001 From: Lino Date: Tue, 28 Nov 2023 15:18:21 +0100 Subject: [PATCH] Change hugo env to prod and simplify github run conditions --- .github/workflows/deploy-dev.yml | 9 ++++++--- .github/workflows/deploy-prod.yml | 3 ++- README.md | 2 +- apache/robots.txt | 2 -- 4 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 apache/robots.txt diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 76ef428..b6fecec 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -4,9 +4,6 @@ on: push: branches-ignore: - main - pull_request: - branches-ignore: - - main jobs: deploy: @@ -26,8 +23,14 @@ jobs: extended: true - name: Build + env: + HUGO_ENV: production run: hugo --minify -b $URL_DEVELOPMENT/$GITHUB_REF_NAME --destination branch/$GITHUB_REF_NAME + - name: Create robots.txt + description: Because we use prod env we have to explicitly create a disallow robots.txt and place it so that it is deployed to the webroot. + run: echo "User-agent: *\nDisallow: /\nSitemap: /sitemap.xml" > branch/robots.txt + - name: Deploy uses: appleboy/scp-action@master with: diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 6b92c2a..0594405 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -4,7 +4,6 @@ on: push: branches: - main - pull_request: jobs: deploy: @@ -24,6 +23,8 @@ jobs: extended: true - name: Build + env: + HUGO_ENV: production run: hugo --minify -b $URL_PRODUCTION - name: Deploy diff --git a/README.md b/README.md index 5e5cfe2..ac4a500 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,4 @@ hugo build --minify -b The website is deployed automatically via github actions. The main branch is at [berlin.freifunk.net](https://berlin.freifunk.net). The other branches could be accessed via `dev.berlin.freifunk.net//`. -The actions are defined in `.github/workflows` and could be configured with [github variables and secrets](https://github.com/freifunk-berlin/berlin.freifunk.net/settings/secrets/actions). The configurations for the production and development webserver are in the `apache` directory. The development setup should also use the `robots.txt` file to deny indexing. \ No newline at end of file +The actions are defined in `.github/workflows` and could be configured with [github variables and secrets](https://github.com/freifunk-berlin/berlin.freifunk.net/settings/secrets/actions). The configurations for the production and development webserver are in the `apache` directory. \ No newline at end of file diff --git a/apache/robots.txt b/apache/robots.txt deleted file mode 100644 index 77470cb..0000000 --- a/apache/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / \ No newline at end of file