-
-
Notifications
You must be signed in to change notification settings - Fork 49
121 lines (100 loc) · 3.5 KB
/
build_and_release.yml
File metadata and controls
121 lines (100 loc) · 3.5 KB
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
name: Build and release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
env:
BIN_NAME: sqlitebiter
DIST_DIR_NAME: dist
jobs:
build_and_release:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest]
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-build-release-${{ matrix.os }}
cancel-in-progress: true
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache-dependency-path: |
setup.py
**/*requirements.txt
tox.ini
- name: Build - Linux
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04'
run: |
make build-deb
# installation test
DEB_PACKAGE=$(find dist -type f -name \*.deb)
sudo dpkg -i $DEB_PACKAGE
- name: Build - macOS
if: matrix.os == 'macos-latest'
run: |
./scripts/build_macos_binary.sh
- name: Build - Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
BIN_PATH=${DIST_DIR_NAME}/${BIN_NAME}.exe
SYSTEM=$(python3 -c "import platform; print(platform.system().casefold())")
MACHINE=$(python3 -c "import platform; machine=platform.machine().casefold(); print('amd64' if machine == 'x86_64' else machine)")
ARCHIVE_PATH=${DIST_DIR_NAME}/${BIN_NAME}_${SYSTEM}_${MACHINE}.zip
python -m pip install -q --upgrade .[all,buildexe] jsonschema-specifications
pyinstaller cli.py --clean --onefile --name "$BIN_NAME" --noconfirm --specpath build --strip \
--collect-all=jsonschema_specifications --hidden-import =jsonschema_specifications
${BIN_PATH} version
powershell compress-archive -Force "$BIN_PATH" "$ARCHIVE_PATH"
- uses: actions/upload-artifact@v4
with:
name: binaries
path: ${{ env.DIST_DIR_NAME }}/${{ env.BIN_NAME }}_*
if-no-files-found: error
retention-days: 1
- name: Release binary packages
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ env.DIST_DIR_NAME }}/${{ env.BIN_NAME }}_*
calc_hash:
needs: [build_and_release]
runs-on: ubuntu-latest
timeout-minutes: 20
env:
SHA_DIR: sha
SHA_TEXT_FILE: sqlitebiter_sha256.txt
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: binaries
path: ${{ env.DIST_DIR_NAME }}
- name: Calculate checksums of binary packages
run: |
set -x
mkdir -p "$SHA_DIR"
cd "$DIST_DIR_NAME"
ls -l --time-style=long-iso --file-type --human-readable --group-directories-first
sha256sum ${BIN_NAME}_* > "../${SHA_DIR}/${SHA_TEXT_FILE}"
- uses: actions/upload-artifact@v4
with:
name: shasum
path: ${{ env.SHA_DIR }}
if-no-files-found: error
retention-days: 1
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.SHA_DIR }}/${{ env.SHA_TEXT_FILE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}