Skip to content

Commit

Permalink
workflow fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shsms committed Jan 23, 2021
1 parent 6947582 commit 7f0a980
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 21 deletions.
62 changes: 46 additions & 16 deletions .github/workflows/weekly-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
on: workflow_dispatch
# on:
# schedule:
# - cron: '* 6 * * 0'
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: '* 1 * * 0'
name: Weekly rebuild
jobs:
generate:
Expand All @@ -10,42 +19,63 @@ jobs:
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 get github.com/shsms/ideacrawler
run: |
go get github.com/shsms/ideacrawler
- 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
install mime /usr/bin/
chmod +x mime
- name: download annotations
run: |
ideacrawler &>/dev/null &
~/go/bin/ideacrawler &>/dev/null &
sleep 1
make -C scripts download
killall ideacrawler
timeout-minutes: 10
- name: add annotations
run: |
make -C scripts addanno
MIME=../mime make -C scripts addanno
- name: generate epub
run: |
export PATH=$PATH:${PWD}
make -C scripts epub
- name: env vars
run: echo "MY_DATE=$(date +%Y.%m.%d)" >> $GITHUB_ENV
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=v$(date +%Y.%m.%d)" >> $GITHUB_ENV
fi
- name: Create Release
id: weekly-rebuild
id: createrelease
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.MY_DATE }}
release_name: ${{ env.MY_DATE }}
draft: true
prerelease: true
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'


6 changes: 4 additions & 2 deletions scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
MIME ?= mime

.PHONY: download addanno epub

download:
go run dl-anno.go annotations-raw/

date=$(shell bash -c "LC_ALL=en_GB.utf8 date '+%B %d, %Y'")
addanno:
mime upd-epub-to-jp.mime --infile ../4300-h/4300-h.htm --outfile /tmp/updated-to-jp.htm
mime add-anno.mime --date "${date}" --anno_path annotations-raw/ --infile /tmp/updated-to-jp.htm --outfile /tmp/annotated.htm --colour_outfile /tmp/colour_annotated.htm
${MIME} upd-epub-to-jp.mime --infile ../4300-h/4300-h.htm --outfile /tmp/updated-to-jp.htm
${MIME} add-anno.mime --date "${date}" --anno_path annotations-raw/ --infile /tmp/updated-to-jp.htm --outfile /tmp/annotated.htm --colour_outfile /tmp/colour_annotated.htm

epub:
ebookmaker \
Expand Down
6 changes: 3 additions & 3 deletions scripts/add-anno.mime
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def update_toc(epub) {
epub.find("</div>");
epub.paste("<br /> <div style=\"text-align: center;\">");
epub.paste("<a href=\"#link2H_4_annotations\"> Annotations </a><br />");
epub.paste("<a href=\"#link2H_4_index_titles\"> Index of Titles </a><br /></div>");
epub.paste("<a href=\"#link2H_4_index_titles\"> Index of Notes </a><br /></div>");

epub.find("<hr />");
epub.paste(pagebreak);
Expand Down Expand Up @@ -543,13 +543,13 @@ def add_notes(epub, main_cur, notes_cur, use_colour) {
def add_notes_index(epub, notes_index, index_cur, notes_cur) {
epub.use_cursor(index_cur);
epub.paste(pagebreak);
epub.paste("<h2>Index of Titles</h2>");
epub.paste("<h2>Index of Notes</h2>");
epub.paste("<a name=\"link2H_4_index_titles\" id=\"link2H_4_index_titles\"> </a>\n")
epub.paste("<p>All of the notes posted so far are listed here alphabetically by title. Click to go directly to a note without locating its appearances in the text of the novel.</p>")

epub.use_cursor(notes_cur);
epub.paste(pagebreak);
epub.paste("<h3>Titles</h3>");
epub.paste("<h3>Notes</h3>");

epub.use_cursor(index_cur);
var count = 0;
Expand Down

0 comments on commit 7f0a980

Please sign in to comment.