-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (136 loc) · 5.04 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Release Build
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
include:
- os: windows-latest
asset_name: watchcat-windows-${{ github.ref_name }}.exe
asset_path: ./dist/watchcat-windows-${{ github.ref_name }}.exe
- os: ubuntu-latest
asset_name: watchcat-linux-${{ github.ref_name }}
asset_path: ./dist/watchcat-linux-${{ github.ref_name }}
- os: macos-latest
asset_name: watchcat-macos-${{ github.ref_name }}.dmg
asset_path: ./dist/watchcat-macos-${{ github.ref_name }}.dmg
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Cache Poetry
uses: actions/cache@v3
with:
path: |
~/.local/share/pypoetry
~/.cache/pypoetry
%APPDATA%\Python\poetry
%LOCALAPPDATA%\pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- name: Cache PyInstaller build
uses: actions/cache@v3
with:
path: |
dist
build
key: ${{ runner.os }}-pyinstaller-${{ hashFiles('**/*.py') }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
if: runner.os != 'Windows'
- name: Install Poetry (Windows)
if: runner.os == 'Windows'
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
echo "$env:APPDATA\Python\Scripts" >> $env:GITHUB_PATH
- name: Configure Poetry
run: |
poetry config virtualenvs.in-project true
poetry config installer.parallel true
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y qt6-base-dev libasound2-dev portaudio19-dev python3-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: poetry install --with dev,macos --no-interaction --no-root
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: poetry install --with dev,linux --no-interaction --no-root
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: poetry install --with dev,windows --no-interaction --no-root
- name: Install project
run: poetry install --only-root
- name: Build with PyInstaller
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
poetry run pyinstaller --clean --onefile --windowed --name watchcat-windows transparent_overlay/main.py
elif [ "${{ runner.os }}" = "Linux" ]; then
poetry run pyinstaller --clean --onefile --windowed --name watchcat-linux transparent_overlay/main.py
else
poetry run pyinstaller --clean --onefile --windowed --name watchcat-macos transparent_overlay/main.py
fi
shell: bash
- name: List dist directory
run: ls -la dist/
shell: bash
- name: Rename with version
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
mv "./dist/watchcat-windows.exe" "./dist/watchcat-windows-${{ github.ref_name }}.exe"
elif [ "${{ runner.os }}" = "Linux" ]; then
mv "./dist/watchcat-linux" "./dist/watchcat-linux-${{ github.ref_name }}"
else
mv "./dist/watchcat-macos" "./dist/watchcat-macos-${{ github.ref_name }}.dmg"
fi
shell: bash
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./dist/watchcat-*-${{ github.ref_name }}*
draft: false
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
generate_release_notes: true
fail_on_unmatched_files: true
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.asset_name }}
path: ./dist/watchcat-*-${{ github.ref_name }}*
if-no-files-found: error
create-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: watchcat-*/*
draft: false
prerelease: false
generate_release_notes: true