Skip to content

Release

Release #4

Workflow file for this run

name: Release VNULIB Downloader
on:
push:
paths:
- src/VERSION.py
workflow_dispatch:
jobs:
prepare:
name: prepare
runs-on: ubuntu-latest
defaults:
run:
shell: bash
outputs:
VERSION: ${{ steps.get-variable.outputs.VERSION }}
SET_PRE_RELEASE: ${{ steps.get-variable.outputs.SET_PRE_RELEASE }}
steps:
- name: Checkout repo
uses: actions/checkout@main
- name: Get version
id: get-variable
run: |
VERSION=$(cat "src/CONSTANTS.py" | grep VERSION | cut -d "=" -f 2 | sed 's/"//g' | sed 's/ //g')
echo "VERSION=$VERSION" >> GITHUB_OUTPUT
if [[ $VERSION == *"beta"* ]]; then
echo "SET_PRE_RELEASE=true" >> GITHUB_OUTPUT
else
echo "SET_PRE_RELEASE=false" >> GITHUB_OUTPUT
fi
build:
name: build
needs: prepare
strategy:
matrix:
os:
- ubuntu
- windows
- macos
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@main
- name: Install python
uses: actions/setup-python@main
with:
cache: "pip"
- name: Install dependacies
run: pip install -r requirements.txt
- name: Build for ${{ matrix.os }}
run: pyinstaller --noconfirm --onefile --console --icon "asset/VNU_HCM_LOGO-256.ico" --name "VNULIB-Downloader-${{ matrix.os }}" --clean --log-level "INFO" --splash "asset/VNU_HCM_LOGO-large.png" --add-data "src;src/" "VNULIB-Downloader.py" -add-data "LICENSE;."
- name: Upload to artifact
uses: actions/upload-artifact@main
with:
name: VNULIB-Downloader-${{ matrix.os }}
path: dist/VNULIB-Downloader-*
compression-level: 6
retention-days: 30
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- prepare
- build
steps:
- name: Download Artifact
uses: actions/download-artifact@main
- name: Upload to Release
uses: svenstaro/upload-release-action@master
with:
body: ${{ needs.prepare.outputs.VERSION }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/VNULIB-Downloader-*
release_name: VNULIB Downloader ${{ needs.prepare.outputs.VERSION }}
tag: ${{ needs.prepare.outputs.VERSION }}
file_glob: true
overwrite: false
prerelease: ${{ needs.prepare.outputs.SET_PRE_RELEASE }}