python-forensics-handbook/.github/workflows/create-release.yml

59 lines
1.7 KiB
YAML

name: github pages
on:
push:
tags:
- 'v*'
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Show version
run: echo $RELEASE_VERSION && echo ${{ env.RELEASE_VERSION }}
- name: Upgrade pip
run: |
# install pip=>20.1 to use "pip cache dir"
python3 -m pip install --upgrade pip
- name: Install dependencies
run: python3 -m pip install -r ./requirements.txt
- name: Build docs
run: (cd doc_src && make html)
- name: Compress docs
run: (cd ./doc_src/_build/ && mv html pyforhandbook_html_docs_${{ env.RELEASE_VERSION }} && zip -qq -r ../../pyforhandbook_html_docs_${{ env.RELEASE_VERSION }}.zip pyforhandbook_html_docs_${{ env.RELEASE_VERSION }})
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload docs to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pyforhandbook_html_docs_${{ env.RELEASE_VERSION }}.zip
asset_name: pyforhandbook_html_docs_${{ env.RELEASE_VERSION }}.zip
asset_content_type: application/zip