Skip to content

Commit

Permalink
try to setup backup site (#19)
Browse files Browse the repository at this point in the history
* try to setup backup site

* name actions

* test subsequent deploy

* fix deploy triggers

* build backup too
  • Loading branch information
verygoodsoftwarenotvirus authored Apr 23, 2024
1 parent 0bdbd79 commit e47420b
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ jobs:
hugo-version: '0.92.1'

- name: Build
run: hugo --destination dist/ --minify --config=config.toml
run: hugo --destination dist/ --minify --config=ru_config.toml

- name: Build
run: hugo --destination dist2/ --minify --config=backup_config.toml

55 changes: 55 additions & 0 deletions .github/workflows/deploy_backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on: # [pull_request]
push:
branches:
- main

name: Deploy Backup
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v4

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.92.1'

- name: Build
run: hugo --destination dist/ --minify --config=backup_config.toml

- name: Upload built blog
uses: actions/upload-artifact@v3
with:
name: website
path: dist/
retention-days: 1

deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GOOGLE_CLOUD_CREDENTIALS }}'

# Setup gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: Download built artifact
uses: actions/download-artifact@v3
with:
name: website
path: dist/

- name: Delete website
run: gsutil -m rm -a gs://verygoodsoftwarenotvirus.blog/**

- name: Deploy website
run: gsutil -m cp -r dist/* gs://verygoodsoftwarenotvirus.blog/
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
on:
on: # [pull_request]
push:
branches:
- main
name: Deploy

name: Deploy Main Site
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,7 +17,7 @@ jobs:
hugo-version: '0.92.1'

- name: Build
run: hugo --destination dist/ --minify --config=config.toml
run: hugo --destination dist/ --minify --config=ru_config.toml

- name: Upload built blog
uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OUTPUT_DIR := dist
CONFIG_FILE := config.toml
RU_CONFIG_FILE := ru_config.toml
GCLOUD_BUCKET := blog.verygoodsoftwarenotvirus.ru
BLOG_GENERATOR := klakegg/hugo:0.92.1
PREVIEW_PORT := 8080
Expand All @@ -21,7 +21,7 @@ pull_image:
@docker pull --quiet $(BLOG_GENERATOR)

$(OUTPUT_DIR): pull_image
$(GENERATOR_CMD) --destination $(OUTPUT_DIR) --minify --config=config.toml
$(GENERATOR_CMD) --destination $(OUTPUT_DIR) --minify --config=$(RU_CONFIG_FILE)

.PHONY: preview
preview: pull_image
Expand Down
78 changes: 78 additions & 0 deletions backup_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
baseURL = "https://verygoodsoftwarenotvirus.blog/"
languageCode = "en-us"
title = "Very Good Software, Not Virus"
theme = "terminal"

[params]
# ["orange", "blue", "red", "green", "pink"]
themeColor = "orange"

# if you set this to 0, only submenu trigger will be visible
showMenuItems = 2

# show selector to switch language
showLanguageSelector = false

# set theme to full screen width
fullWidthTheme = false

# center theme with default width
centerTheme = true

# if your resource directory contains an image called `cover.(jpg|png|webp)`,
# then the file will be used as a cover automatically.
# With this option you don't have to put the `cover` param in a front-matter.
autoCover = true

# set post to show the last updated
# If you use git, you can set `enableGitInfo` to `true` and then post will automatically get the last updated
showLastUpdated = true

# set a custom favicon (default is a `themeColor` square)
# favicon = "favicon.ico"

# Provide a string as a prefix for the last update date. By default, it looks like this: 2020-xx-xx [Updated: 2020-xx-xx] :: Author
# updatedDatePrefix = "Updated"

# set all headings to their default size (depending on browser settings)
# oneHeadingSize = true # default

# whether to show a page's estimated reading time
# readingTime = true # default

# whether to show a table of contents
# can be overridden in a page's front-matter
# Toc = false # default

# set title for the table of contents
# can be overridden in a page's front-matter
# TocTitle = "Table of Contents" # default

[languages]
[languages.en]
languageName = "English"
title = "Very Good Software, Not Virus"
subtitle = "a lowly software developer's blog"
owner = ""
keywords = ""
copyright = ""
menuMore = "Show more"
readMore = "Read more"
readOtherPosts = "Read other posts"
newerPosts = "Newer posts"
olderPosts = "Older posts"
missingContentMessage = "Page not found..."
missingBackButtonLabel = "Back to home page"

[languages.en.params.logo]
logoText = "Terminal"
logoHomeLink = "/"

# [languages.en.menu]
# [[languages.en.menu.main]]
# identifier = "about"
# name = "About"
# url = "/about"

[markup.goldmark.renderer]
unsafe = true
7 changes: 0 additions & 7 deletions config.toml → ru_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ theme = "terminal"
# can be overridden in a page's front-matter
# TocTitle = "Table of Contents" # default

[params.twitter]
# set Twitter handles for Twitter cards
# see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution
# do not include @
creator = "vgnsv"
site = "https://blog.verygoodsoftwarenotvirus.ru/"

[languages]
[languages.en]
languageName = "English"
Expand Down

0 comments on commit e47420b

Please sign in to comment.