Weekly rebuild #222
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
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag for new release' | |
required: true | |
default: 'v2020.01.01-alpha' | |
draft: | |
description: 'Draft release? (true/false)' | |
required: true | |
default: 'true' | |
schedule: | |
- cron: '10 2 * * 0' | |
name: Weekly rebuild | |
jobs: | |
generate: | |
name: generate annotated epub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@master | |
- name: install-deps | |
run: | | |
sudo apt-get update | |
sudo apt-get remove python | |
sudo apt-get install python3 tidy calibre python3-pip | |
sudo -H pip3 install setuptools | |
sudo -H pip3 install ebookmaker pytidylib | |
- name: get ideacrawler | |
run: | | |
go install github.com/shsms/[email protected] | |
- name: get mime | |
run: | | |
curl -OL https://github.com/shsms/mime/releases/latest/download/mime-linux-amd64.tar.gz | |
tar -xvf mime-linux-amd64.tar.gz | |
chmod +x mime | |
- name: download annotations | |
run: | | |
~/go/bin/ideacrawler &>/dev/null & | |
sleep 1 | |
make -C scripts download | |
killall ideacrawler | |
timeout-minutes: 30 | |
- name: add annotations | |
run: | | |
MIME=../mime make -C scripts addanno | |
mkdir -p reader/badges | |
cp scripts/badge-*json reader/badges/ | |
- name: generate epub | |
run: | | |
export PATH=$PATH:${PWD} | |
make -C scripts epub | |
cp ulysses-annotated.epub reader/ | |
- name: env vars | |
run: | | |
if [[ "${{ github.event.inputs.tag }}" != "" ]]; then | |
echo "TAG_STR=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
else | |
echo "TAG_STR=v$(date +%Y.%m.%d)" >> $GITHUB_ENV | |
fi | |
if [[ "${{ github.event.inputs.draft }}" != "" ]]; then | |
echo "DRAFT_STR=${{ github.event.inputs.draft }}" >> $GITHUB_ENV | |
else | |
echo "DRAFT_STR=false" >> $GITHUB_ENV | |
fi | |
- name: Create Release | |
id: createrelease | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_STR }} | |
release_name: ${{ env.TAG_STR }} | |
draft: ${{ env.DRAFT_STR }} | |
prerelease: false | |
- name: Upload the artifacts | |
uses: skx/github-action-publish-binaries@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
releaseId: ${{ steps.createrelease.outputs.id }} | |
args: 'ulysses-annotated*.epub' | |
- name: Deploy web reader | |
uses: JamesIves/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: reader | |
CLEAN: true |