Skip to content

Commit

Permalink
Make releases from workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
goerz committed Dec 27, 2020
1 parent 6b443de commit 01f9f6f
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ jobs:
run: sudo apt-get install graphviz imagemagick

- name: Install Tox and other build requirements
run: pip install tox zip-files
run: pip install tox zip-files does_not_exist_to_test_failure

- name: Generate HTML Documentation
run: tox -e docs

- name: Generate LaTeX Documentation
if: startsWith(github.ref, 'refs/tags/')
run: |
tox -e docs -- -b latex docs/_build/latex
tox -e run-cmd -- python docs/sources/build_pdf.py --patch-only docs/_build/latex/*.tex
- uses: xu-cheng/latex-action@v2
if: startsWith(github.ref, 'refs/tags/')
name: Compile LaTex (first pass)
with:
compiler: lualatex
Expand All @@ -39,6 +41,7 @@ jobs:
root_file: qalgebra.tex

- uses: xu-cheng/latex-action@v2
if: startsWith(github.ref, 'refs/tags/')
name: Compile LaTex (second pass)
with:
compiler: lualatex
Expand All @@ -51,6 +54,7 @@ jobs:
run: echo ::set-output name=VERSION::$(python -c 'print([line.split("=")[-1].strip()[1:-1] for line in open("./src/qalgebra/__init__.py", encoding="utf8").readlines() if line.startswith("__version__")][0], end="")')

- name: Get branch name
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
echo ${{ github.ref }}
Expand All @@ -61,21 +65,38 @@ jobs:
run: zip-folder --debug --auto-root --outfile "qalgebra-docs-${{ steps.get_version.outputs.VERSION }}.zip" docs/_build/html

- name: Rename the PDF documentation
if: startsWith(github.ref, 'refs/tags/')
run: mv docs/_build/latex/qalgebra.pdf "qalgebra-docs-${{ steps.get_version.outputs.VERSION }}.pdf"

- uses: actions/upload-artifact@v2
name: Upload documentation artifacts
with:
name: qalgebra-docs
# We need at least two files in the artifact to avoid a weird
# double-zip file. Hence README.md
path: |
./qalgebra-docs-${{ steps.get_version.outputs.VERSION }}.zip
./qalgebra-docs-${{ steps.get_version.outputs.VERSION }}.pdf
README.md
./qalgebra-docs-${{ steps.get_version.outputs.VERSION }}.*
create_github_release:
name: Create a Github Release
runs-on: ubuntu-18.04
if: startsWith(github.ref, 'refs/tags/')
needs: build_docs
steps:

- name: Get version
shell: bash
run: |
echo ${{ github.ref }}
echo "RELEASE_VERSION=$(echo ${GITHUB_REF##*/} | cut -c 2- )" >> $GITHUB_ENV
cat $GITHUB_ENV
deploy_gh_pages:
name: Deploy documentation to gh-pages
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
if: always() && needs.build_docs.result == 'success' && (github.ref == 'refs/heads/releases' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
runs-on: ubuntu-18.04
needs: build_docs
needs: [build_docs, create_github_release]
steps:

- uses: actions/setup-python@v2
Expand Down

0 comments on commit 01f9f6f

Please sign in to comment.