-
Notifications
You must be signed in to change notification settings - Fork 65
81 lines (70 loc) · 2.78 KB
/
python-windows-exe.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
name: Build Windows Executable - PyInstaller
# Description:
# Most of my projects come with a build.bat script that uses PyInstaller to freeze the examples
# to an executable file. This Action will set up the envrionment and run this build.bat script,
# then upload the resulting executables to a google cloud bucket.
# Additionally the executables will be compressed and encrypted using 7z
on:
push:
branches:
- main # Trigger on push to master branch
jobs:
build:
runs-on: windows-latest # Use a Windows runner
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCLOUD_BUCKET_SERVICE_USER_SECRET }}'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller virtualenv
- name: Run Batch File to Build Executable
run: builder\pyinstaller\build.bat
- name: Compress executables
run: |
"C:\Program Files\7-Zip\7z.exe" a secure.7z *.exe -pprotected
working-directory: ${{ github.workspace }}/builder/pyinstaller
shell: cmd
#- name: Upload Executable
# uses: actions/upload-artifact@v2
# with:
# name: executable
# path: builder\pyinstaller\*.exe
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
version: '>= 390.0.0'
- name: Upload Executables to GCS
run: |
$PROJVERSION = python -c "import sys; sys.path.append('${{ github.event.repository.name }}'); import _version; print(_version.__version__)"
Write-Host "Detected Version: $PROJVERSION"
gsutil cp builder\pyinstaller\*.exe gs://skelsec-github-foss/${{ github.event.repository.name }}/$PROJVERSION/
gsutil cp builder\pyinstaller\*.7z gs://skelsec-github-foss/${{ github.event.repository.name }}/$PROJVERSION/
shell: powershell
- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
content: "Hey <@here>! New build happened for project ${{ github.event.repository.name }}!"
title: "build"
description: |
Version `${{ github.event.release.tag_name }}`
Click [here](${{ github.event.release.html_url }}) to download!
#image: ${{ secrets.EMBED_IMAGE }}
color: 0x0000ff
url: "${{ github.server_url }}/${{ github.repository }}"
username: GitHub Actions
avatar_url: "https://avatars.githubusercontent.com/u/19204702"