-
-
Notifications
You must be signed in to change notification settings - Fork 17
90 lines (79 loc) · 2.65 KB
/
windows.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 for Windows 64-bit # and 32-bit
on:
workflow_call:
push:
branches:
- main
permissions:
contents: write
pages: write
id-token: write
packages: write
attestations: write
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
job:
- { vcpkg_triplet: x64-windows-static-release , arch: x86_64 }
# - { vcpkg_triplet: x86-windows-static-release , arch: i686 }
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install SQLite
run: |
choco install sqlite
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.job.arch }}-pc-windows-msvc
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build
continue-on-error: true
shell: cmd
run: |
set "DATABASE_URL=sqlite://%CD%/db_v2.sqlite3"
set "DATABASE_URL=sqlite://%CD%/db_v2.sqlite3" && cargo build --release --target ${{ matrix.job.arch }}-pc-windows-msvc
cd target\${{ matrix.job.arch }}-pc-windows-msvc\release
7z a -tzip windows_${{ matrix.job.arch }}_${{ github.event.release.tag_name }}.zip sctgdesk-api-server.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows_${{ matrix.job.arch }}
path: |
target/${{ matrix.job.arch }}-pc-windows-msvc/release/sctgdesk-api-server.exe
- name: Create Release with gh
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export TAG_NAME=${{ github.event.release.tag_name }}
export TAG_NAME=${TAG_NAME:-"nightly"}
echo $TAG_NAME
ls .
mv target/${{ matrix.job.arch }}-pc-windows-msvc/release/sctgdesk-api-server.exe windows_${{ matrix.job.arch }}_${TAG_NAME}.exe
gh release create $TAG_NAME -t "$TAG_NAME" -n "$TAG_NAME" || true
gh release upload $TAG_NAME windows_${{ matrix.job.arch }}_${TAG_NAME}.exe --clobber