-
Notifications
You must be signed in to change notification settings - Fork 19
180 lines (157 loc) · 6.67 KB
/
release.yaml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Release
permissions:
contents: write
on:
push:
tags:
- "v*.*.*"
jobs:
checks:
name: Check version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.12.8
- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.8.3"
- name: Check project version matches tag name
run: |
[ "`poetry version --short`" == "${{ github.ref_name }}" ]
build:
needs: checks
runs-on: ${{ matrix.OS }}
strategy:
matrix:
include:
- OS: ubuntu-20.04
PYTHON_VERSION: 3.12.8
BUILD_CMD: |
export PYTHONHASHSEED=42
export BUILD_FILE_NAME=operator-${RELEASE_VERSION}-linux-amd64;
mkdir ${BUILD_FILE_NAME};
git rev-parse --short HEAD > GIT_SHA
poetry run pyinstaller \
--distpath ./${BUILD_FILE_NAME} \
./operator.spec;
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ${BUILD_FILE_NAME};
mkdir /tmp/artifacts;
cp ${BUILD_FILE_NAME}.tar.gz /tmp/artifacts;
sha256sum ${BUILD_FILE_NAME}.tar.gz | head -c 64 > /tmp/artifacts/${BUILD_FILE_NAME}.sha256;
- OS: linux-arm-runner
PYTHON_VERSION: 3.12.8
BUILD_CMD: |
export PYTHONHASHSEED=42
export BUILD_FILE_NAME=operator-${RELEASE_VERSION}-linux-arm64;
mkdir ${BUILD_FILE_NAME};
git rev-parse --short HEAD > GIT_SHA
poetry run pyinstaller \
--distpath ./${BUILD_FILE_NAME} \
./operator.spec;
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ${BUILD_FILE_NAME};
rm -rf /tmp/artifacts;
mkdir /tmp/artifacts;
cp ${BUILD_FILE_NAME}.tar.gz /tmp/artifacts;
sha256sum ${BUILD_FILE_NAME}.tar.gz | head -c 64 > /tmp/artifacts/${BUILD_FILE_NAME}.sha256;
- OS: macos-14
PYTHON_VERSION: 3.12.8
BUILD_CMD: |
export PYTHONHASHSEED=42
export BUILD_FILE_NAME=operator-${RELEASE_VERSION}-darwin-arm64;
mkdir ${BUILD_FILE_NAME};
git rev-parse --short HEAD > GIT_SHA
poetry run pyinstaller \
--distpath ./${BUILD_FILE_NAME} \
./operator.spec;
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ${BUILD_FILE_NAME};
mkdir /tmp/artifacts || true;
cp -f ${BUILD_FILE_NAME}.tar.gz /tmp/artifacts;
shasum -a 256 ${BUILD_FILE_NAME}.tar.gz | head -c 64 > /tmp/artifacts/${BUILD_FILE_NAME}.sha256
- OS: windows-latest
PYTHON_VERSION: 3.12.8
BUILD_CMD: |
$RELEASE_VERSION = $env:GITHUB_REF.replace('refs/tags/', '')
$BUILD_FILE_NAME = "operator-" + $RELEASE_VERSION + "-windows-amd64"
$BUILD_FILE_NAME_PATH = ".\" + $BUILD_FILE_NAME
git rev-parse --short HEAD > GIT_SHA
poetry run pyinstaller `
--distpath ./${BUILD_FILE_NAME} `
./operator.spec;
$ZIP_FILE_NAME = $BUILD_FILE_NAME + ".zip"
Compress-Archive -Path $BUILD_FILE_NAME_PATH -DestinationPath $ZIP_FILE_NAME
mkdir \tmp\artifacts
copy $ZIP_FILE_NAME \tmp\artifacts\
$CHECKSUM_FILE_NAME_PASH = "\tmp\artifacts\" + $BUILD_FILE_NAME + ".sha256"
certUtil -hashfile $ZIP_FILE_NAME SHA256 | findstr /i /v "SHA256" | findstr /i /v "CertUtil" > $CHECKSUM_FILE_NAME_PASH
steps:
- uses: actions/checkout@v4
- name: Install build dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y build-essential curl libpq-dev postgresql-client
if: matrix.os == 'linux-arm-runner'
- name: Install build dependencies for MacOS
run: |
brew install libpq
brew link --force libpq
brew install [email protected]
if: matrix.os == 'macos-14'
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON_VERSION }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.8.3"
- name: Install dependencies
run: poetry install --with build --without dev --no-interaction --no-root
env:
# For building psycopg on MacOS
# Required the the same version of openssl as the one used by the Python installation
LDFLAGS: "-L/opt/homebrew/opt/[email protected]/lib"
CPPFLAGS: "-I/opt/homebrew/opt/[email protected]/include"
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Build executable for ${{ matrix.OS }}
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.VERSION }}
run: ${{ matrix.BUILD_CMD }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.OS }}
path: /tmp/artifacts/*
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Display structure of downloaded files
run: ls -R
working-directory: /tmp/artifacts
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
/tmp/artifacts/ubuntu-20.04/operator-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz
/tmp/artifacts/ubuntu-20.04/operator-${{ steps.get_version.outputs.VERSION }}-linux-amd64.sha256
/tmp/artifacts/linux-arm-runner/operator-${{ steps.get_version.outputs.VERSION }}-linux-arm64.tar.gz
/tmp/artifacts/linux-arm-runner/operator-${{ steps.get_version.outputs.VERSION }}-linux-arm64.sha256
/tmp/artifacts/macos-14/operator-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz
/tmp/artifacts/macos-14/operator-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.sha256
/tmp/artifacts/windows-latest/operator-${{ steps.get_version.outputs.VERSION }}-windows-amd64.zip
/tmp/artifacts/windows-latest/operator-${{ steps.get_version.outputs.VERSION }}-windows-amd64.sha256