From 5d2a65b3eedd44789661f6e37e219c9840da471c Mon Sep 17 00:00:00 2001 From: Torben <59419684+entorb@users.noreply.github.com> Date: Sat, 18 May 2024 12:22:35 +0200 Subject: [PATCH] Upload eBooks as artifact --- .github/workflows/check-and-ebook.yml | 45 ++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-and-ebook.yml b/.github/workflows/check-and-ebook.yml index 00aa1b9e5..e4fa4daf0 100644 --- a/.github/workflows/check-and-ebook.yml +++ b/.github/workflows/check-and-ebook.yml @@ -33,10 +33,11 @@ jobs: - name: Calculate hash on chapters/*.tex id: calculate-hash run: | - current_date=$(date -u '+%Y-%m-%d') + # current_date=$(date -u '+%Y-%m-%d') + branch=${{ github.ref_name }} hashed=${{ hashFiles('chapters/*.tex') }} - echo "hash=${current_date}-${hashed}" >> $GITHUB_OUTPUT - echo "${current_date}-${hashed}" > hash-chapters.txt + echo "hash=${branch}-${hashed}" >> $GITHUB_OUTPUT + touch hash-chapters.txt - name: Cache lookup id: cache-lookup @@ -52,6 +53,11 @@ jobs: # no packages installed, so no caching # cache: "pip" + - name: Install and run pytest + run: | + pip install pytest + pytest + - name: Check chapters for known issues run: python3 -O scripts/check_chapters.py @@ -91,7 +97,6 @@ jobs: run: | pwd ls -l - echo ${{ needs.check.outputs.cache-hit }} - name: Install apt packages using cache uses: awalsh128/cache-apt-pkgs-action@latest @@ -124,9 +129,35 @@ jobs: pwd ls -l - - name: Publish eBooks to release - # run only for push into main - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + - name: Upload eBooks as artifact + uses: actions/upload-artifact@v4 + with: + name: ebooks + path: | + ./hpmor.docx + ./hpmor.html + ./hpmor.epub + ./hpmor.mobi + ./hpmor.fb2 + retention-days: 7 + + # + # make upload to release WorkInProgress + # + upload: + needs: make + # only for push into main branch + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + + runs-on: ubuntu-24.04 + + steps: + - name: Download eBooks artifact + uses: actions/download-artifact@v4 + with: + name: ebooks + + - name: Publish eBooks to release WorkInProgress uses: softprops/action-gh-release@v2 with: tag_name: WorkInProgress