-
Notifications
You must be signed in to change notification settings - Fork 5
102 lines (88 loc) · 2.81 KB
/
build-executable.yml
File metadata and controls
102 lines (88 loc) · 2.81 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Build executables
on:
push:
tags:
- 'v*'
jobs:
create-release:
name: Create release
runs-on: [ubuntu-latest]
steps:
- name: Check out code
uses: actions/checkout@v1
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: AshCalc ${{ github.ref }}
draft: false
prerelease: false
- name: Output Release URL File
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt
build-and-upload:
name: Build and upload executable
needs: [create-release]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest] # ${{ matrix.OS_NAME }}
include:
- os: ubuntu-latest
OS_NAME: ubuntu
PYTHON_VERSION: 3.6.x
EXTENSION:
- os: windows-latest
OS_NAME: windows
PYTHON_VERSION: 3.6.x
EXTENSION: .exe
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Load release URL file from previous job
uses: actions/download-artifact@v4.1.7
with:
name: release_url
- name: Get upload URL
id: get_release_info
shell: bash
run: |
value=`cat release_url/release_url.txt`
echo ::set-output name=upload_url::$value
- name: Get the version
shell: bash
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{matrix.PYTHON_VERSION}}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller==4.2
- name: Build with pyinstaller
shell: bash
run: |
pyinstaller --onefile --hidden-import='pkg_resources.py2_warn' ashcalc.py
# --icon=./resources/icon.ico
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./dist/ashcalc${{matrix.EXTENSION}}
asset_name: AshCalc-${{ steps.get_version.outputs.version }}-${{ matrix.OS_NAME }}${{matrix.EXTENSION}}
asset_content_type: application/zip