67 lines
2.0 KiB
YAML

name: website
#on: [push] # debugging only
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF:10}
- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-stable
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-stable
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: 'stable'
- name: Install libsnappy
run: sudo apt-get install libsnappy1v5
- name: Install leveldb c library
run: |
wget http://ftp.us.debian.org/debian/pool/main/l/leveldb/libleveldb1d_1.22-3_amd64.deb
wget http://ftp.us.debian.org/debian/pool/main/l/leveldb/libleveldb-dev_1.22-3_amd64.deb
sudo dpkg -i *.deb
- name: Build and test
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
nimble build -Y
nimble test -Y
- name: Build doc
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
# Due to bug https://github.com/nim-lang/Nim/issues/14281, compile the documentation separately.
nimble doc --project --git.url:https://github.com/$GITHUB_REPOSITORY --git.commit:$RELEASE_VERSION src/leveldb.nim
find .
# Deploying documentation of the latest version.
mkdir -p ./public
mv src/htmldocs/* public/
cd ./public/
ln -s ./leveldb.html index.html
cd ../
- name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@v1.3.0
with:
target_branch: gh-pages
build_dir: ./public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}