-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (77 loc) · 2.45 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Release
on:
push:
paths:
- src/constants.py
workflow_dispatch:
jobs:
prepare:
name: prepare
runs-on: ubuntu-latest
defaults:
run:
shell: bash
outputs:
VERSION: ${{ steps.get_variables.outputs.VERSION }}
SET_PRE_RELEASE: ${{ steps.get_variables.outputs.SET_PRE_RELEASE }}
CONTINUE: ${{ steps.get_variables.outputs.CONTINUE }}
steps:
- name: Checkout repo
uses: actions/checkout@main
- name: Prepare Version & Set Pre Release
id: get_variables
run: script/checkRelease.sh
build:
name: build
needs: prepare
strategy:
matrix:
os:
- ubuntu
- windows
- macos
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 10
if: ${{ needs.prepare.outputs.CONTINUE == 'true' }}
steps:
- name: Checkout repo
uses: actions/checkout@main
- name: Install python
uses: actions/setup-python@main
with:
cache: pip
python-version: "3.12"
- name: Install dependacies
run: pip install -r requirements.txt && pip install pyinstaller
- name: Build for ${{ matrix.os }}
run: pyinstaller --noconfirm --onefile --console --icon "asset/image/VNU_HCM_LOGO-256.ico" --name "VNULIB-Downloader-${{ matrix.os }}" --log-level "INFO" --add-data "src/:src/" --add-data "asset/image/error_page.jpg:asset/image/" --add-data "LICENSE:." "main.py"
- 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
if: ${{ needs.prepare.outputs.CONTINUE == 'true' }}
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: ./VNULIB-Downloader-*/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 }}