This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
90 lines (75 loc) · 2.67 KB
/
build-and-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
name: Build and release
on:
push:
tags: [ '*' ]
env:
OUTPUT_EXE_NAME: lokbot
jobs:
build-windows-x86:
runs-on: windows-2019
env:
ARCH: '86'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x${{ env.ARCH }}'
- name: Install requirements
run: python -m pip install pipenv
- run: pipenv sync
- run: pipenv install PyInstaller
- name: Run PyInstaller
run: pipenv run python -m PyInstaller --add-data "lokbot/assets/;lokbot/assets" -F lokbot/__main__.py -n "${{ env.OUTPUT_EXE_NAME }}.${{ github.ref_name }}.x${{ env.ARCH }}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.OUTPUT_EXE_NAME }}.${{ github.ref_name }}.x${{ env.ARCH }}.exe
path: dist/${{ env.OUTPUT_EXE_NAME }}.${{ github.ref_name }}.x${{ env.ARCH }}.exe
build-windows-x64:
runs-on: windows-2019
env:
ARCH: '64'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x${{ env.ARCH }}'
- name: Install requirements
run: python -m pip install pipenv
- run: pipenv sync
- run: pipenv install PyInstaller
- name: Run PyInstaller
run: pipenv run python -m PyInstaller --add-data "lokbot/assets/;lokbot/assets" -F lokbot/__main__.py -n "${{ env.OUTPUT_EXE_NAME }}.${{ github.ref_name }}.x${{ env.ARCH }}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.OUTPUT_EXE_NAME }}.${{ github.ref_name }}.x${{ env.ARCH }}.exe
path: dist/${{ env.OUTPUT_EXE_NAME }}.${{ github.ref_name }}.x${{ env.ARCH }}.exe
release:
needs: [ 'build-windows-x86', 'build-windows-x64' ]
runs-on: ubuntu-20.04
steps:
- name: Download all artifact
uses: actions/download-artifact@v3
with:
path: assets
- name: Calculate artifact's hash
id: hash
run: |
dgst=$(openssl dgst -sha256 assets/**/${{ env.OUTPUT_EXE_NAME }}* | sed -E "s/assets\/.+?\///")
dgst="${dgst//'%'/'%25'}"
dgst="${dgst//$'\n'/'%0A'}"
dgst="${dgst//$'\r'/'%0D'}"
echo "::set-output name=hash::$dgst"
- name: Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.hash.outputs.hash }}
generate_release_notes: true
files: ${{ github.workspace }}/assets/**/${{ env.OUTPUT_EXE_NAME }}*