-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (159 loc) · 6.85 KB
/
build-and-publish.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
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
name: Build and publish GitHub release
on:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install cargo toolchain (1.79.0)
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
- name: Install cargo toolchain (nightly-2024-07-17)
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-07-17
- name: Restore cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Restore PostgreSQL cache
id: cache-pgsql
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/temp/pgsql
key: pgsql-win-x64-15.3.4
- name: Download PostgreSQL binaries
if: steps.cache-pgsql.outputs.cache-hit != 'true'
uses: suisei-cn/[email protected]
with:
url: https://get.enterprisedb.com/postgresql/postgresql-15.3-4-windows-x64-binaries.zip
target: /temp/pg-dl/
filename: pg.zip
- name: Extract PostgreSQL binaries
if: steps.cache-pgsql.outputs.cache-hit != 'true'
shell: pwsh
run: 7z x -o"${{ github.workspace}}/temp/" /temp/pg-dl/pg.zip pgsql/lib/* pgsql/bin/*
- name: Build parcel-server
uses: actions-rs/cargo@v1
env:
PQ_LIB_DIR: ${{ github.workspace }}/temp/pgsql/lib
with:
toolchain: 1.79.0
command: build
args: --release -p parcel-server --target x86_64-pc-windows-msvc
- name: Build parcel-client
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-07-17
command: build
args: --release -p parcel-client --target x86_64-pc-windows-msvc
- name: Build client-injector
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-07-17
command: build
args: --release -p client-injector --target x86_64-pc-windows-msvc
- name: Move dist files to temp folder
run: |
mkdir ${{ github.workspace }}/dist-server/
mkdir ${{ github.workspace }}/dist-client/
cp ${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/parcel-server.exe ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/parcel_server.pdb ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/temp/pgsql/bin/libcrypto-3-x64.dll ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/temp/pgsql/bin/libiconv-2.dll ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/temp/pgsql/bin/libintl-9.dll ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/temp/pgsql/bin/libpq.dll ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/temp/pgsql/bin/libssl-3-x64.dll ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/temp/pgsql/bin/libwinpthread-1.dll ${{ github.workspace }}/dist-server/
cp ${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/parcel_client.dll ${{ github.workspace }}/dist-client/
cp ${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/parcel_client.pdb ${{ github.workspace }}/dist-client/
cp ${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/client-injector.exe ${{ github.workspace }}/dist-client/
cp ${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/client_injector.pdb ${{ github.workspace }}/dist-client/
- name: Upload parcel-server artifact
uses: actions/upload-artifact@v3
with:
path: dist-server/*
name: parcel-server_x86_64-pc-windows-msvc
- name: Upload parcel-client artifact
uses: actions/upload-artifact@v3
with:
path: dist-client/*
name: parcel-client_x86_64-pc-windows-msvc
build-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install cargo toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
- name: Restore cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build parcel-server
uses: actions-rs/cargo@v1
with:
toolchain: 1.79.0
command: build
args: --release -p parcel-server --target x86_64-unknown-linux-gnu
- name: Upload parcel-server artifact
uses: actions/upload-artifact@v3
with:
name: parcel-server_x86_64-unknown-linux-gnu
path: target/x86_64-unknown-linux-gnu/release/parcel-server
create-release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux]
steps:
- uses: actions/checkout@v3
- name: Download windows server artifact
uses: actions/download-artifact@v3
with:
name: parcel-server_x86_64-pc-windows-msvc
path: ./parcel-server_x86_64-pc-windows-msvc
- name: Download linux server artifact
uses: actions/download-artifact@v3
with:
name: parcel-server_x86_64-unknown-linux-gnu
path: ./parcel-server_x86_64-unknown-linux-gnu
- name: Download windows parcel-client artifact
uses: actions/download-artifact@v3
with:
name: parcel-client_x86_64-pc-windows-msvc
path: ./parcel-client_x86_64-pc-windows-msvc
- name: Copy game data json file to server data folder
run: |
mkdir ./parcel-server_x86_64-pc-windows-msvc/data/
mkdir ./parcel-server_x86_64-unknown-linux-gnu/data/
cp ./re-testing/exported-data.json ./parcel-server_x86_64-pc-windows-msvc/data/game_data.json
cp ./re-testing/exported-data.json ./parcel-server_x86_64-unknown-linux-gnu/data/game_data.json
- name: Create release zip files
run: |
zip -r ./parcel-server_x86_64-pc-windows-msvc.zip ./parcel-server_x86_64-pc-windows-msvc
zip -r ./parcel-server_x86_64-unknown-linux-gnu.zip ./parcel-server_x86_64-unknown-linux-gnu
zip -r ./parcel-client_x86_64-pc-windows-msvc.zip ./parcel-client_x86_64-pc-windows-msvc
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
draft: true
fail_on_unmatched_files: true
target_commitish: ${{ github.sha }}
generate_release_notes: true
files: |
./parcel-server_x86_64-pc-windows-msvc.zip
./parcel-server_x86_64-unknown-linux-gnu.zip
./parcel-client_x86_64-pc-windows-msvc.zip