ci: update ci #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Make Distribution | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
jobs: | |
make_dist: | |
name: Make Distribution File(${{ matrix.os }}) | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows | |
filetag: win-x86_64 | |
- os: ubuntu | |
filetag: linux-x86_64 | |
- os: macos | |
filetag: macos-x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
cache-dependency-path: | | |
requirements.txt | |
requirements_gui.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install -U -r requirements.txt -r requirements_gui.txt | |
mkdir downloads | |
- name: Write version file | |
run: | | |
echo "__version__ = '${{ github.ref_name }}'" > gui/__version__.py | |
- name: Make executable windows | |
if: matrix.os == 'windows' | |
run: | | |
pyinstaller --onefile --clean --windowed --icon=resource/kindle.ico -n kindle_download_helper kindle_gui.py | |
- name: Make executable linux | |
if: matrix.os != 'windows' | |
run: | | |
pyinstaller --onefile --clean --windowed --icon=resource/kindle.icns -n kindle_download_helper kindle_gui.py | |
- name: Make dist(MacOS) | |
if: matrix.os == 'macos' | |
run: | | |
brew install create-dmg | |
create-dmg --window-pos 200 120 --window-size 800 300 --icon-size 100 --app-drop-link 600 20 downloads/kindle-${{ matrix.filetag }}.dmg dist/kindle_download_helper.app | |
- name: Make dist(Windows) | |
if: matrix.os == 'windows' | |
run: | | |
Compress-Archive -Path dist\kindle_download_helper.exe -DestinationPath downloads\kindle-${{ matrix.filetag }}.zip | |
- name: Make dist(Linux) | |
if: matrix.os == 'ubuntu' | |
run: | | |
zip -j downloads/kindle-${{ matrix.filetag }}.zip dist/kindle_download_helper | |
- name: Archive Distribution Files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: downloads/* | |
create_release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: make_dist | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Dists | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Generate Release Notes | |
run: npx changelogithub | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |