-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (97 loc) · 3.5 KB
/
release.yml
File metadata and controls
117 lines (97 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgresql://pointer:pointer@localhost:5432/pointer
jobs:
build-musl:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18
ports:
- 5432:5432
env:
POSTGRES_USER: pointer
POSTGRES_PASSWORD: pointer
POSTGRES_DB: pointer
options: >-
--health-cmd="pg_isready -U pointer -d pointer"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown,x86_64-unknown-linux-musl
- name: Cache cargo data
uses: Swatinem/rust-cache@v2
- name: Install build tooling
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-client build-essential musl-tools
- name: Install cargo-leptos (prebuilt)
uses: taiki-e/install-action@v2
with:
tool: cargo-leptos
- name: Cache sqlx-cli
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-cli-${{ hashFiles('Cargo.lock', 'backend/Cargo.lock') }}
- name: Install sqlx-cli
run: |
if ! command -v sqlx >/dev/null; then
cargo install --locked sqlx-cli --no-default-features --features postgres,rustls
fi
- name: Wait for Postgres
run: pg_isready -h localhost -p 5432 -U pointer -d pointer
env:
PGUSER: pointer
PGPASSWORD: pointer
- name: Apply migrations
working-directory: backend
run: sqlx migrate run --source migrations
env:
PGUSER: pointer
PGPASSWORD: pointer
- name: Build pointer (wasm + binary)
env:
LEPTOS_BIN_TARGET_TRIPLE: x86_64-unknown-linux-musl
run: cargo leptos build --release -P --bin-features ssr
- name: Build pointer-backend
run: cargo build --locked --release -p pointer-backend --target x86_64-unknown-linux-musl
- name: Build pointer-indexer
run: cargo build --locked --release -p pointer-indexer --target x86_64-unknown-linux-musl --features vendored
- name: Build pointer-reposerver
run: cargo build --locked --release -p pointer-reposerver --target x86_64-unknown-linux-musl
- name: Package artifacts
run: |
set -euo pipefail
mkdir -p artifacts pointer/target
# Package pointer assets + binary
POINTER_BIN="$(find target -path '*/release/pointer' -type f | head -n1)"
cp "$POINTER_BIN" pointer/pointer
cp -r target/site pointer/target/site
cp Cargo.toml pointer/Cargo.toml
tar -czf artifacts/pointer.tar.gz -C pointer .
# Package backend, indexer, and reposerver binaries
for bin in pointer-backend pointer-indexer pointer-reposerver; do
BIN_PATH="$(find target -path "*/release/${bin}" -type f | head -n1)"
cp "$BIN_PATH" "artifacts/${bin}"
done
tar -czf "pointer-linux-amd64.tar.gz" -C artifacts .
- name: Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
files: pointer-linux-amd64.tar.gz
generate_release_notes: true