Skip to content

Commit

Permalink
Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
czerwonamaupa committed Feb 3, 2020
1 parent ed5e4b8 commit 87abab5
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 817 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v6
- run: |
mkdir -p ~/.config/nixpkgs
echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix
- uses: cachix/cachix-action@v3
with:
name: czerwonamaupa
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- uses: actions/upload-artifact@v1
with:
name: web
path: result
- uses: actions/upload-artifact@v1
with:
name: dialektyka-oswiecenia.epub
path: result/ebooks
- uses: actions/upload-artifact@v1
with:
name: dialektyka-oswiecenia.mobi
path: result/ebooks

gh-pages:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: web
path: .
- uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: web

release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v1
with:
name: dialektyka-oswiecenia.epub
path: .
- uses: actions/download-artifact@v1
with:
name: dialektyka-oswiecenia.mobi
path: .
- uses: softprops/action-gh-release@v1
with:
files: |
dialektyka-oswiecenia.epub
dialektyka-oswiecenia.mobi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/styles/ebook.css
/ebooks/*
/*.html
/*.css
/*.epub
/*.mobi
/result
24 changes: 24 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
with import <nixpkgs> {};
let
pandoc = import (fetchTarball {
url = "https://github.com/czerwonamaupa/pandoc/archive/413af81436a09f554a2ee575f063d8abed15ecd6.tar.gz";
sha256 = "1q7bc087ipp8bb0gf9yr29wh0mgvrb7ipsx3gcpi94ann2knykak";
}) {};
pythonInputs = python3.withPackages (pkgs: with pkgs; [pandocfilters pyphen]);
drv = stdenv.mkDerivation {
pname = "Dialektyka-Oswiecenia";
version = "v1.4";
src = nix-gitignore.gitignoreSource [] ./.;
buildInputs = [ pandoc kindlegen pythonInputs ];
installPhase = ''
mkdir -p $out/web
cp -r {index.html,web.css,fonts} $out/web
mkdir -p $out/ebooks
cp dialektyka-oswiecenia.{epub,mobi} $out/ebooks
'';
};
shell = mkShell {
inputsFrom = [ drv ];
buildInputs = [ entr ];
};
in drv // { inherit shell; }
783 changes: 0 additions & 783 deletions index.html

This file was deleted.

54 changes: 28 additions & 26 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
default : index.html ebooks/dialektyka-oswiecenia.mobi
default : index.html dialektyka-oswiecenia.mobi

index.html : chapters/* styles/index.css styles/html.css template.t filters/*
web.css : styles/index.css styles/html.css
cat styles/index.css > web.css && cat styles/html.css >> web.css

index.html : chapters/* web.css template.t filters/*
pandoc \
-s \
--filter filters/hyphenate.py \
--section-divs \
-o index.html \
-c styles/index.css \
-c styles/html.css \
--template template.t \
chapters/*
-s \
--filter filters/hyphenate.py \
--section-divs \
-o index.html \
-c web.css \
--template template.t \
chapters/*

styles/ebook.css : styles/index.css styles/epub.css
cat styles/index.css > styles/ebook.css && cat styles/epub.css >> styles/ebook.css
ebook.css : styles/index.css styles/epub.css
cat styles/index.css > ebook.css && cat styles/epub.css >> ebook.css

ebooks/dialektyka-oswiecenia.epub : chapters/* styles/ebook.css template.t filters/* cover.jpg
dialektyka-oswiecenia.epub : chapters/* ebook.css template.t filters/* cover.jpg
pandoc \
-s \
--filter filters/hyphenate.py \
--section-divs \
--toc-depth=2 \
--epub-cover-image cover.jpg \
-o ebooks/dialektyka-oswiecenia.epub \
-c styles/ebook.css \
--template template.t \
-t epub3 \
chapters/*
-s \
--filter filters/hyphenate.py \
--section-divs \
--toc-depth=2 \
--epub-cover-image cover.jpg \
-o dialektyka-oswiecenia.epub \
-c ebook.css \
--template template.t \
-t epub3 \
chapters/*

ebooks/dialektyka-oswiecenia.mobi : ebooks/dialektyka-oswiecenia.epub
kindlegen ebooks/dialektyka-oswiecenia.epub
dialektyka-oswiecenia.mobi : dialektyka-oswiecenia.epub
kindlegen dialektyka-oswiecenia.epub

clean :
$(RM) ebooks/* index.html styles/ebook.css
$(RM) dialektyka-oswiecenia.epub dialektyka-oswiecenia.mobi index.html web.css ebook.css
2 changes: 0 additions & 2 deletions nix-shell.sh

This file was deleted.

1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(import ./.).shell
8 changes: 4 additions & 4 deletions styles/html.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
@font-face
{ font-family: libertine;
src: url(../fonts/LinLibertine_R.woff); }
src: url(fonts/LinLibertine_R.woff); }

@font-face
{ font-family: libertine;
font-style: italic;
src: url(../fonts/LinLibertine_RI.woff); }
src: url(fonts/LinLibertine_RI.woff); }

@font-face
{ font-family: libertine;
font-weight: bold;
src: url(../fonts/LinLibertine_RB.woff); }
src: url(fonts/LinLibertine_RB.woff); }

@font-face
{ font-family: libertine;
font-weight: bold;
font-style: italic;
src: url(../fonts/LinLibertine_RBI.woff); }
src: url(fonts/LinLibertine_RBI.woff); }

body
{ font-family: libertine, serif; }
Expand Down

0 comments on commit 87abab5

Please sign in to comment.