chore: ci/cd cleanup #273
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'deploy website and ebooks' | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
job_deploy_website: | |
name: 'deploy website' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 11 | |
check-latest: true | |
- name: 'Generating distributable files' | |
run: | | |
rm -f README.md | |
mv content/* . | |
mv etc/cover_small.jpg . | |
mv etc/cover_square.png . | |
mv etc/cover.jpg . | |
mv etc/custom.css . | |
mv etc/main.go . | |
mv etc/robots.txt . | |
npm install -g gitbook-cli | |
gitbook install | |
cd ~/.gitbook/versions/3.2.3 && npm i npm@5 | |
cd ${{ github.workspace }} | |
mv etc/book.json . | |
gitbook install | |
go run main.go -mode=webbook -adjustment=pre | |
gitbook build | |
go run main.go -mode=webbook -adjustment=post | |
cd _book | |
echo '<html><head><meta http-equiv="refresh" content="0; url=https://dasarpemrogramangolang.novalagung.com/"></head></html>' > 404.html | |
rm -rf *.md | |
rm -rf .gitmodules | |
rm -rf main.go | |
rm -rf in-progress | |
rm -rf crowdin.yml | |
rm -rf LICENSE | |
rm -rf package-lock.json | |
rm -rf package.json | |
rm -rf etc | |
- name: 'Deploying' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_book | |
job_deploy_ebook: | |
name: 'deploy ebook' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 11 | |
check-latest: true | |
- name: 'Installing requirements' | |
run: | | |
npm install -g gitbook-cli svgexport | |
sudo apt install libegl1 libopengl0 libxcb-cursor0 | |
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin | |
- name: 'Generating distributable files' | |
run: | | |
rm -f README.md | |
mv content/* . | |
mv etc/cover_small.jpg . | |
mv etc/cover_square.png . | |
mv etc/cover.jpg . | |
go run main.go -mode=ebook -adjustment=pre | |
gitbook install | |
- name: 'Generating ebook in pdf' | |
run: gitbook pdf ./ ./_book/dasarpemrogramangolang.pdf | |
continue-on-error: true | |
- name: 'Generating ebook in epub' | |
run: gitbook epub ./ ./_book/dasarpemrogramangolang.epub | |
continue-on-error: true | |
- name: 'Generating ebook in mobi' | |
run: gitbook mobi ./ ./_book/dasarpemrogramangolang.mobi | |
continue-on-error: true | |
- name: 'Deploying' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_book | |
publish_branch: ebooks |