-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (116 loc) · 4.47 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
name: Release
on:
push:
tags:
- "*.*.*"
permissions:
contents: write
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
id: ${{ steps.create_release.outputs.id }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
Release ${{ steps.vars.outputs.tag }} of crypt4gh GUI (Graphical User Interface).
build_release:
name: Upload Release Asset
needs: create_release
strategy:
max-parallel: 4
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
artifact_name: crypt4gh-gui
os_suffix: linux-amd64
asset_name: crypt4gh-gui
- os: windows-latest
artifact_name: crypt4gh-gui.exe
os_suffix: windows-amd64
asset_name: crypt4gh-gui
- os: macos-latest
artifact_name: crypt4gh-gui
os_suffix: macos-amd64
asset_name: crypt4gh-gui
python-version: ["3.10"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install python3-dev -y
- name: Install Windows dependencies
if: matrix.os == 'windows-latest'
run: |
choco install zip
- name: Install macOS dependencies
if: matrix.os == 'macOS-latest'
run: |
brew install coreutils
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install pyinstaller-versionfile
- name: Build GUI artifact Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
docker pull cscfi/pyinstaller
docker run --rm -v "${PWD}:/builder" cscfi/pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
sudo chown -R $USER:$GROUP dist/
- name: Build GUI artifact macOS
if: matrix.os == 'macOS-latest'
run: |
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
- name: Build GUI artifact windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
TAG=${{ github.ref_name }}
VERSION=${TAG/.0*./.${TAG:6:1}.} # remove leading zero for windows version
create-version-file versionfile.yml --outfile file_version_info.txt --version $VERSION
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }} --version-file file_version_info.txt
- name: Create temporary certificate file
if: matrix.os == 'windows-latest'
run: |
cd ${{ github.workspace }}
echo "${{ secrets.CERTIFICATE_BASE64 }}" >> certificate.b64
certutil -decode certificate.b64 certificate.crt
del certificate.b64
- name: Sign windows executable
if: matrix.os == 'windows-latest'
shell: cmd
env:
PASSWORD_ENV: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |
cd ${{ github.workspace }}
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe" sign /f .\certificate.crt /p %PASSWORD_ENV% /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 .\dist\${{ matrix.artifact_name }}
del certificate.crt
- name: Build Asset
run: |
cd ./dist
zip --junk-paths ${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip ${{ matrix.artifact_name }}
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./dist/${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip
fail_on_unmatched_files: true