-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (127 loc) · 4.03 KB
/
build.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
version:
runs-on: 'ubuntu-latest'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checking out the repo
uses: actions/checkout@v4
- name: Figure out version string
id: version
shell: sh
run: |
# get the latest commit hash in the short form
COMMIT=$(git rev-parse --short HEAD)
# get the latest commit date in the form of YYYYmmdd
DATE=$(git log -1 --format=%cd --date=format:'%y%m%d%H%M')
echo "version=${DATE}-${COMMIT}" >> "$GITHUB_OUTPUT"
build:
needs: [version]
# convert this to a matrix if builds differ between platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['windows-latest', 'macos-latest']
# ['ubuntu-latest']
outputs:
version: ${{ needs.version.outputs.version }}
steps:
- name: Checking out the repo
uses: actions/checkout@v4
# see *py_ver* in ci/update.py
- name: Setting up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --progress-bar=off -r requirements.txt
python -m pip install pyinstaller
- name: Build
env:
VERSION: ${{ needs.version.outputs.version }}
shell: sh
run: |
OS=${{ matrix.os }}
sed -i -e "s/\(name=['\"]\)\([^'\"\.]\+\)\(\(\.[^'\"]\+\)\?['\"],\)/\1\2-$VERSION-${OS%-*}\3/" LiveFT.spec
cat LiveFT.spec # show result of sed replacement
pyinstaller LiveFT.spec
- name: Create DMG
if: matrix.os == 'macos-latest'
shell: sh
run: |
cd dist
fn="$(ls -d LiveFT*.app)"; fn="${fn%.*}"
hdiutil create -fs HFS+ -srcfolder "$fn.app" -volname "$fn" "$fn.dmg"
rm -Rf "$fn.app" "$fn"
- name: Store built packages for publishing later
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: dist/*.*
publish:
needs: [build]
runs-on: 'ubuntu-latest'
steps:
- name: Download previuously built package artifacts
uses: actions/download-artifact@v4
with:
pattern: package-*
merge-multiple: true
path: dist
- name: Check contents
run: pwd; ls -la; ls -la dist
- name: Get version string
env:
VERSION: ${{ needs.build.outputs.version }}
run: |
echo "version: '$VERSION'"${{ needs.build.outputs.version }}
- name: Release
uses: softprops/action-gh-release@v2
with:
make_latest: true
draft: false
prerelease: false
tag_name: ${{ needs.build.outputs.version }}
files: dist/*
# publish:
# needs: [build]
# runs-on: 'ubuntu-latest'
# steps:
#
# - name: Checking out the repo
# uses: actions/checkout@v4
#
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install --progress-bar=off -r ci/requirements.txt
#
# - name: Download package artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: packages-*
# merge-multiple: true
# path: dist
#
# - name: Check generated packages
# run: twine check dist/*.*
#
# - name: Upload packages
# env:
# TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}"
# TWINE_NON_INTERACTIVE: 1
# run: |
# twine upload --disable-progress-bar --skip-existing -u __token__ -r pypi dist/*.*