-
-
Notifications
You must be signed in to change notification settings - Fork 170
179 lines (169 loc) · 6.29 KB
/
release.yml
File metadata and controls
179 lines (169 loc) · 6.29 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
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
on:
workflow_dispatch: {}
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
branches:
- "release-test"
name: Create Release
permissions:
contents: write
actions: read
jobs:
build-macos-windows:
name: Build sqlpage binaries (macOS & Windows)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
include:
- os: windows-latest
binary_extension: .exe
target: x86_64-pc-windows-msvc
features: ""
- os: macos-latest
target: x86_64-apple-darwin
features: "odbc-static"
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build
run: cargo build --profile superoptimized --locked --target ${{ matrix.target }} --features "${{ matrix.features }}"
- name: Upload unsigned Windows artifact
if: matrix.os == 'windows-latest'
id: upload_unsigned
uses: actions/upload-artifact@v4
with:
name: unsigned-windows
path: target/${{ matrix.target }}/superoptimized/sqlpage.exe
if-no-files-found: error
- name: Submit signing request to SignPath
if: matrix.os == 'windows-latest'
id: signpath
uses: signpath/github-action-submit-signing-request@v1.1
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: '45fd8443-c7ca-4d29-a68b-608948185335'
project-slug: 'sqlpage'
signing-policy-slug: 'release-signing'
github-artifact-id: ${{ steps.upload_unsigned.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: './signed-windows'
wait-for-completion-timeout-in-seconds: 7200
service-unavailable-timeout-in-seconds: 1800
download-signed-artifact-timeout-in-seconds: 1800
- name: Upload signed Windows artifact
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: sqlpage windows-latest
path: signed-windows/sqlpage.exe
if-no-files-found: error
- name: Upload artifact (non-Windows)
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: sqlpage ${{ matrix.os }}
path: target/${{ matrix.target }}/superoptimized/sqlpage${{ matrix.binary_extension }}
if-no-files-found: error
build-linux:
name: Build sqlpage binaries (Linux)
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Cache Cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build
run: cargo build --profile superoptimized --locked --target x86_64-unknown-linux-gnu --features "odbc-static"
- uses: actions/upload-artifact@v4
with:
name: sqlpage ubuntu-latest
path: target/x86_64-unknown-linux-gnu/superoptimized/sqlpage
if-no-files-found: error
build-aws:
name: Build AWS Lambda Serverless zip image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
- run: docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
- uses: actions/upload-artifact@v4
with:
name: sqlpage aws lambda serverless image
path: sqlpage-aws-lambda.zip
create_release:
name: Create Github Release
needs: [build-macos-windows, build-linux, build-aws]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- run: |
rm -rf sqlpage/templates/*.handlebars;
chmod +x sqlpage*/sqlpage;
mv 'sqlpage macos-latest/sqlpage' sqlpage.bin;
tar --create --file sqlpage-macos.tgz --gzip sqlpage.bin sqlpage/sqlpage.json sqlpage/migrations sqlpage/templates sqlpage/sqlpage.json;
mv 'sqlpage ubuntu-latest/sqlpage' sqlpage.bin;
tar --create --file sqlpage-linux.tgz --gzip sqlpage.bin sqlpage/migrations sqlpage/templates sqlpage/sqlpage.json;
mv 'sqlpage windows-latest/sqlpage.exe' .
zip -r sqlpage-windows.zip sqlpage.exe sqlpage/migrations sqlpage/templates sqlpage/sqlpage.json;
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(github.ref_name, 'beta') }}
files: |
sqlpage-windows.zip
sqlpage-linux.tgz
sqlpage-macos.tgz
sqlpage aws lambda serverless image/sqlpage-aws-lambda.zip
cargo_publish:
name: Publish to crates.io
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Cache Cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- run: sudo apt-get update && sudo apt-get install -y unixodbc-dev
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}