Skip to content

Merge pull request #2371 from dipu-bd/dev #85

Merge pull request #2371 from dipu-bd/dev

Merge pull request #2371 from dipu-bd/dev #85

Workflow file for this run

name: Build and Publish
on:
push:
tags:
- "v*"
jobs:
validate:
if: github.repository == 'dipu-bd/lightnovel-crawler'
name: Lint & Test
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Check VERSION file
run: |
[ "${GITHUB_REF##*/}" == "v$(head -n 1 lncrawl/VERSION)" ] || exit 100
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip wheel setuptools
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8 -v --count --show-source --statistics
- name: Build wheel
run: python setup.py clean bdist_wheel
- name: Install and test the wheel package
run: |
pip install dist/lightnovel_crawler*.whl
lncrawl --list-sources
lncrawl -s 'https://novelfull.com/the-kings-avatar-for-the-glory.html' --first 2 -f --format epub --suppress -lll
build-windows:
if: github.repository == 'dipu-bd/lightnovel-crawler'
needs: validate
name: Windows Build
runs-on: windows-latest
steps:
- name: Install OpenSSL
run: choco install -y --no-progress openssl
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build package
env:
PYTHONIOENCODING: utf-8
run: .\scripts\build.bat
- name: Test the executable package
env:
PYTHONIOENCODING: utf-8
run: .\dist\lncrawl.exe --list-sources
- name: Release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with: # See available options at https://github.com/ncipollo/release-action
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "dist/lncrawl*"
token: ${{ secrets.GITHUB_TOKEN }}
build-linux:
if: github.repository == 'dipu-bd/lightnovel-crawler'
needs: [validate, build-windows]
name: Linux Build & Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build package
run: sh ./scripts/build.sh
- name: Test the executable package
run: ./dist/lncrawl --list-sources
- name: Release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with: # See available options at https://github.com/ncipollo/release-action
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "dist/lncrawl,dist/*.whl"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update download links
env:
REBRANDLY_API_KEY: ${{ secrets.REBRANDLY_API_KEY }}
run: sh ./scripts/rebrandly.sh
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_NON_INTERACTIVE: true
run: sh ./scripts/publish.sh