-
-
Notifications
You must be signed in to change notification settings - Fork 22
155 lines (134 loc) · 5.22 KB
/
build_gui_linux.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
name: Build GUI (Linux x64)
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build-pornfetch-gui-linux-x64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.11 x64
uses: actions/setup-python@v2
with:
python-version: 3.11
architecture: x64
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
pip install PySide6 nuitka zstandard
- name: Build application for x64
run: |
mkdir deploy
shopt -s extglob
mv !(deploy|venv) deploy/ # Ensure venv is not moved
cd deploy
pwd
ls -la
source ../venv/bin/activate
pyside6-deploy -c src/build/pysidedeploy_linux.spec main.py
- name: Archive x64 build
uses: actions/upload-artifact@v2
with:
name: pyside6-application-x64
path: deploy/main.bin#
create-release:
needs: build-pornfetch-gui-linux-x64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install gh CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Download Linux x64 artifact
uses: actions/download-artifact@v2
with:
name: pyside6-application-x64
path: ./artifacts
- name: List artifacts directory
run: ls -R ./artifacts
- name: Get short SHA
id: vars
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Verify PAT
run: |
curl -H "Authorization: token ${{ secrets.PAT }}" https://api.github.com/user
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Check if Release Exists
id: check_release
run: |
if gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} >/dev/null 2>&1; then
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV
echo "::set-output name=release_exists::true"
else
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV
echo "::set-output name=release_exists::false"
fi
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Calculate SHA512 for Linux x64
id: sha512_linux_x64
run: |
sha512sum ./artifacts/main.bin | awk '{ print $1 }' > sha512_linux_x64.txt
echo "sha512_linux_x64=$(cat sha512_linux_x64.txt)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
if: steps.check_release.outputs.release_exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
SHA512_WINDOWS_X64: ${{ env.sha512_windows_x64 }}
with:
tag_name: v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }}
release_name: Automated Release v${{ secrets.VERSION }}-${{ env.GITHUB_SHA_SHORT }}
body: |
This is an automated release generated by the CI/CD pipeline.
SHA512 Checksums:
draft: false
prerelease: true
- name: Get current release body
id: get_release_body
run: |
gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json body --jq .body > current_body.txt || echo "" > current_body.txt
- name: Append new SHA512 hash to release body
id: append_release_body
run: |
echo -e "$(cat current_body.txt)\n- PornFetch_GUI_Linux_x64: ${{ env.sha512_linux_x64 }}" > new_body.txt
- name: Update GitHub release
run: |
gh release edit v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --notes "$(cat new_body.txt)"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash
- name: Get Release Upload URL
id: get_release_url
run: |
UPLOAD_URL=$(gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json uploadUrl --jq .uploadUrl)
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
echo "::set-output name=upload_url::$UPLOAD_URL"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash
- name: Upload Linux x64 artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./artifacts/main.bin
asset_name: PornFetch_GUI_Linux_x64.bin
asset_content_type: application/octet-stream