From 819f0e3bdec05574a845f5efbfc8d1443520875e Mon Sep 17 00:00:00 2001 From: Xie Yanbo Date: Wed, 26 Feb 2020 14:15:50 +0800 Subject: [PATCH] using github actions to build documentation --- .github/workflows/main.yml | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3007dd7 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,62 @@ +name: website + +#on: [push] +on: + push: + tags: + - 'v*.*.*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v1 + - 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.0.2 + 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 + env: + RELEASE_VERSION: ${{ steps.vars.outputs.tag }} + run: | + nimble build -Y + nimble test -Y + nimble doc --project --git.url:https://github.com/$GITHUB_REPOSITORY src/leveldb.nim --git.commit:$RELEASE_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 }}