github: switch to action from travis (#153)

This commit is contained in:
Changkun Ou
2020-12-17 23:45:11 +01:00
committed by GitHub
parent 66297323ad
commit 7ab24fe51c
5 changed files with 35 additions and 23 deletions

29
.github/workflows/website.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Website
on:
push:
branches: [ master ]
jobs:
build:
name: Website
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: build
env:
USER: ${{ secrets.SERVER_USER }}
TARGET: ${{ secrets.SERVER_PATH }}
KEY: ${{ secrets.SERVER_KEY }}
DOMAIN: ${{ secrets.SERVER_DOMAIN }}
run: |
make build
mkdir ~/.ssh
echo "$KEY" | tr -d '\r' > ~/.ssh/id_ed25519
chmod 400 ~/.ssh/id_ed25519
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
ssh-keyscan -H $DOMAIN >> ~/.ssh/known_hosts
scp -r website/public/modern-cpp/* $USER@$DOMAIN:$TARGET

View File

@@ -1,18 +0,0 @@
services:
- docker
before_install:
- openssl aes-256-cbc -K $encrypted_9157553ce13c_key -iv $encrypted_9157553ce13c_iv -in .travis/travis.enc -out ~/.ssh/id_rsa -d
- chmod 600 ~/.ssh/id_rsa
- git config --global user.name "Changkun Ou"
- git config --global user.email "hi@changkun.us"
addons:
ssh_known_hosts:
- changkun.de
script:
- make build
after_success:
scp -r website/public/modern-cpp/* $encrypted_server_user@changkun.de:$encrypted_server_path

Binary file not shown.

View File

@@ -1,4 +1,5 @@
DOCKER_ENV=changkun/modern-cpp-tutorial:build-env
NAME=modern-cpp-tutorial
DOCKER_ENV=changkun/$(NAME):build-env
TARGET = pdf epub
LANGS = zh-cn en-us
ALL_BUILDS = website $(TARGET)
@@ -11,14 +12,14 @@ $(TARGET): $(LANGS)
mkdir -p website/public/modern-cpp/$@/
for lang in $^ ; do \
cd $@/$${lang} && make && make clean && cd ../..; \
mv $@/$${lang}/modern-cpp-tutorial.$@ website/public/modern-cpp/$@/modern-cpp-tutorial-$${lang}.$@; \
mv $@/$${lang}/$(NAME).$@ website/public/modern-cpp/$@/$(NAME)-$${lang}.$@; \
done
website:
cd website && make
build:
docker run --rm -v `pwd`:/modern-cpp-tutorial -it $(DOCKER_ENV) make
docker run --rm -v `pwd`:/$(NAME) $(DOCKER_ENV) make
# dev

View File

@@ -1,10 +1,10 @@
FROM node:latest
LABEL "maintainer"="Changkun Ou <hi@changkun.us>"
LABEL "maintainer"="Changkun Ou <hi[at]changkun.de>"
LABEL "repository"="https://github.com/changkun/modern-cpp-tutorial"
LABEL "homepage"="https://changkun.de/modern-cpp/"
# FUCKING UNICODE
# For Unicode
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8