Compare commits

...

3 commits

Author SHA1 Message Date
576d108b3b [#25] Deploy the site via SSH
All checks were successful
build static site / build (pull_request) Successful in 27s
build static site / build (push) Successful in 1m2s
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-09-05 12:21:34 +03:00
6190e5a098 [#25] Build the site with Forgejo Actions
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-09-05 12:21:34 +03:00
449a8c33bd [#25] Store hugo binary in versioned path
This will simplify runner cache invalidation
when we will start building the site with CI

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-09-05 12:21:34 +03:00
4 changed files with 68 additions and 7 deletions

View file

@ -0,0 +1,55 @@
name: build static site
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
container:
image: node:22-bookworm
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache@v4
with:
path: |-
bin/
themes/
key: hugo-${{ runner.os }}-${{ hashFiles('Makefile', 'config.toml') }}
restore-keys: |
hugo-${{ runner.os }}
hugo
- name: make all
run: |
git submodule sync
rm -rf themes/dot-hugo
make all
- name: Setup SSH environment
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.socket
run: |
umask 0077
mkdir -p ~/.ssh/
ssh-keyscan frostfs.info >> ~/.ssh/known_hosts
ssh-keygen -A # create host keys
ssh-agent -a "$SSH_AUTH_SOCK"
echo "${{ secrets.SSH_DEPLOY_KEY }}" > ~/.ssh/key
stat ~/.ssh/key
ssh-keygen -y -f ~/.ssh/key
ssh-add ~/.ssh/key
rm ~/.ssh/key
- name: make deploy
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
ssh-add -L
make deploy
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.socket

2
.gitignore vendored
View file

@ -3,7 +3,7 @@
*.log *.log
*.lock *.lock
tmp/ tmp/
bin/hugo bin/hugo*
public/ public/
resources/_gen resources/_gen

2
.gitmodules vendored
View file

@ -1,4 +1,4 @@
[submodule "themes/dot-hugo"] [submodule "themes/dot-hugo"]
path = themes/dot-hugo path = themes/dot-hugo
url = git@git.frostfs.info:TrueCloudLab/dot-hugo.git url = https://git.frostfs.info/TrueCloudLab/dot-hugo
branch = frostfs_design_version branch = frostfs_design_version

View file

@ -3,26 +3,32 @@ SHELL = bash
PUBDIR = public PUBDIR = public
HUGO_VERSION = 0.91.0 HUGO_VERSION = 0.91.0
HUGO_BIN ?= bin/hugo HUGO_BIN ?= bin/hugo-$(HUGO_VERSION)
.PHONY: all clean .PHONY: all clean
all: public all: public
bin/hugo: bin/hugo-$(HUGO_VERSION):
@wget -q https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_extended_$(HUGO_VERSION)_Linux-64bit.tar.gz -O - |\ @wget -q https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_extended_$(HUGO_VERSION)_Linux-64bit.tar.gz -O - |\
tar -xz -C bin/ hugo; tar -xz -C bin/ hugo;
@mv bin/hugo $@
clean: clean:
@rm -rf $(PUBDIR) @rm -rf $(PUBDIR)
@rm -rf tmp @rm -rf tmp
@rm -rf bin/hugo @rm -rf bin/hugo*
public: submodules bin/hugo public: submodules $(HUGO_BIN)
@$(HUGO_BIN) @$(HUGO_BIN)
server: submodules bin/hugo server: submodules $(HUGO_BIN)
@$(HUGO_BIN) server --disableFastRender @$(HUGO_BIN) server --disableFastRender
submodules: submodules:
@git submodule init @git submodule init
@git submodule update --recursive --remote @git submodule update --recursive --remote
.PHONY: deploy
deploy:
test -f public/index.html
cd public && tar --gzip --create . | ssh deploy@frostfs.info frostfs.info