-
Notifications
You must be signed in to change notification settings - Fork 5
227 lines (189 loc) · 7.09 KB
/
release.yaml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Create Release
on:
push:
branches:
- main
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.1'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: Build the project
run: |
pyinstaller --noconfirm --onedir --windowed --icon "$(pwd)/content_scheduler/socialmediascheduler/logo.ico" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/gui" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/scheduler" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/controller" \
"manage.py"
- name: Copy additional files
run: |
Copy-Item -Path "sample.env" -Destination "dist/manage/sample.env"
Copy-Item -Path "config.yaml" -Destination "dist/manage/config.yaml"
Copy-Item -Path "logo.png" -Destination "dist/manage/logo.png"
Copy-Item -Path "database_default.sqlite3" -Destination "dist/manage/database_default.sqlite3"
- name: Zip the manage folder
run: |
cd dist
Compress-Archive -Path manage -DestinationPath manage.zip
Move-Item -Path manage.zip -Destination $env:GITHUB_WORKSPACE
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: my-app-windows
path: ${{ github.workspace }}/manage.zip
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.1'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: Build the project
run: |
pyinstaller --noconfirm --onedir --windowed --icon "$(pwd)/content_scheduler/socialmediascheduler/logo.ico" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/gui" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/scheduler" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/controller" \
"manage.py"
- name: Copy additional files
run: |
cp sample.env dist/manage/sample.env
cp config.yaml dist/manage/config.yaml
cp logo.png dist/manage/logo.png
cp database_default.sqlite3 dist/manage/database_default.sqlite3
- name: Zip the manage folder
run: |
cd dist
zip -r manage.zip manage
mv manage.zip $GITHUB_WORKSPACE
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: my-app-linux
path: ${{ github.workspace }}/manage.zip
build-mac:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12.4'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
- name: List content_scheduler directory
run: ls -R content_scheduler
- name: List socialmediascheduler directory
run: ls -R content_scheduler/socialmediascheduler
- name: Build the project
run: |
pyinstaller --noconfirm --onedir --windowed --icon "$(pwd)/content_scheduler/socialmediascheduler/logo.ico" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/gui" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/scheduler" \
--paths "$(pwd)/content_scheduler/socialmediascheduler/controller" \
"manage.py"
- name: Copy additional files
run: |
cp sample.env dist/manage/sample.env
cp config.yaml dist/manage/config.yaml
cp logo.png dist/manage/logo.png
cp database_default.sqlite3 dist/manage/database_default.sqlite3
- name: Zip the manage folder
run: |
cd dist
zip -r manage.zip manage
mv manage.zip $GITHUB_WORKSPACE
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: my-app-mac
path: ${{ github.workspace }}/manage.zip
create_release:
needs: [build-windows, build-linux, build-mac]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download build artifact (Windows)
uses: actions/download-artifact@v2
with:
name: my-app-windows
path: manage-windows.zip
- name: Download build artifact (Linux)
uses: actions/download-artifact@v2
with:
name: my-app-linux
path: manage-linux.zip
- name: Download build artifact (Mac)
uses: actions/download-artifact@v2
with:
name: my-app-mac
path: manage-mac.zip
- name: Generate release name and tag
id: generate_release_info
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if [[ "$COMMIT_MESSAGE" =~ ^Release.* ]]; then
TAG_NAME=$(echo "$COMMIT_MESSAGE" | awk '{print $2}')
RELEASE_NAME=$(echo "$COMMIT_MESSAGE" | awk '{$1=""; print $0}')
else
TAG_NAME="release-$(date +'%Y%m%d%H%M%S')"
RELEASE_NAME="Release $(date +'%Y-%m-%d %H:%M:%S')"
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: false
- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manage-windows.zip
asset_name: manage-windows.zip
asset_content_type: application/zip
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manage-linux.zip
asset_name: manage-linux.zip
asset_content_type: application/zip
- name: Upload Release Asset (Mac)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manage-mac.zip
asset_name: manage-mac.zip
asset_content_type: application/zip