-
Notifications
You must be signed in to change notification settings - Fork 4
135 lines (115 loc) Β· 4.32 KB
/
release-workflow.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
# This workflow will install Python dependencies, create Hamster dist for Windows, macOS (Intel and Apple).
# It will also create a GitHub release and upload the artifacts to it.
name: Hamster
on:
push:
branches: [ "feature/telemetry" ]
paths-ignore:
- '**/**.md'
jobs:
build:
runs-on: ${{ matrix.os }}
env:
RELEASE_TAG: 0.2.0
INTEL_DMG: Hamster-x86-64-intel.dmg
ARM64_DMG: Hamster-arm64-silicon.dmg
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
strategy:
matrix:
os: [ self-hosted, macos, windows-latest ]
arch: [ 'X64', 'ARM64', 'X86' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10.11
uses: actions/setup-python@v3
with:
python-version: "3.10.11"
- name: Install dependencies in Windows
run: |
python -m pip install --upgrade pip
pip install -r .\windows\requirements.txt
if: matrix.os == 'windows-latest'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install py2app
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if: matrix.os == 'macos' || matrix.os == 'self-hosted'
- name: Generate app for intel architecture
run: |
export MIXPANEL_TOKEN=${{ env.MIXPANEL_TOKEN }}
python setup.py py2app
mv dist dist-intel
if: matrix.os == 'macos' && matrix.arch == 'X64'
- name: Generate app for arm64 architecture
run: |
export MIXPANEL_TOKEN=${{ env.MIXPANEL_TOKEN }}
python setup.py py2app
mv dist dist-arm64
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
- name: Generate app for windows
run: |
python .\windows\setup.py bdist_msi
mv dist dist-windows
if: matrix.os == 'windows-latest'
- name: Convert dist-intel to DMG
run: |
hdiutil create -volname "Hamster" -srcfolder dist-intel -ov -format UDZO dist-intel/${{ env.INTEL_DMG }}
if: matrix.os == 'macos' && matrix.arch == 'X64'
- name: Convert dist-arm64 to DMG
run: |
hdiutil create -volname "Hamster" -srcfolder dist-arm64 -ov -format UDZO dist-arm64/${{ env.ARM64_DMG }}
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
- name: Upload intel app
uses: actions/upload-artifact@v2
with:
name: Hamster-macos-intel-x86_64
path: dist-intel/${{ env.INTEL_DMG }}
if: matrix.os == 'macos' && matrix.arch == 'X64'
- name: Upload arm64 app
uses: actions/upload-artifact@v2
with:
name: Hamster-macos-apple-arm64
path: dist-arm64/${{ env.ARM64_DMG }}
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
- name: Upload windows app
uses: actions/upload-artifact@v2
with:
name: Hamster-windows-x86_64
path: dist-windows/Hamster-*.msi
if: matrix.os == 'windows-latest'
- name: GitHub Tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ env.RELEASE_TAG }}
github_token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
- name: Release Darwin
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main' && matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
with:
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
body: 'Release for commit ${{ github.sha }}'
tag_name: ${{ env.RELEASE_TAG }}
generate_release_notes: true
files: |
dist-arm64/${{ env.ARM64_DMG }}
- name: Release Intel
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main' && matrix.os == 'macos' && matrix.arch == 'X64'
with:
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
body: 'Release for commit ${{ github.sha }}'
generate_release_notes: true
tag_name: ${{ env.RELEASE_TAG }}
files: |
dist-intel/${{ env.INTEL_DMG }}
- name: Release Windows
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main' && matrix.os == 'windows-latest'
with:
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
body: 'Release for commit ${{ github.sha }}'
generate_release_notes: true
tag_name: ${{ env.RELEASE_TAG }}
files: |
dist-windows/Hamster-*.msi