-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (115 loc) · 4.03 KB
/
release-server.yml
File metadata and controls
132 lines (115 loc) · 4.03 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
name: Release QuickMark Server
on:
push:
tags:
- 'quickmark-server@*'
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
suffix: .exe
- target: x86_64-apple-darwin
os: macos-13
suffix: ''
- target: aarch64-apple-darwin
os: macos-14
suffix: ''
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
suffix: ''
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
suffix: ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build quickmark-server
run: cargo build --release --bin quickmark-server --target ${{ matrix.target }}
- name: Prepare binary archive
id: binary-archive
shell: bash
run: |
ARCHIVE_NAME="quickmark-server-${{ matrix.target }}.tar.gz"
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT
# Create archive with the binary renamed to quickmark-server
mkdir -p archive-temp
cp "target/${{ matrix.target }}/release/quickmark-server${{ matrix.suffix }}" archive-temp/quickmark-server${{ matrix.suffix }}
tar -czf "$ARCHIVE_NAME" -C archive-temp quickmark-server${{ matrix.suffix }}
rm -rf archive-temp
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.binary-archive.outputs.archive_name }}
path: ${{ steps.binary-archive.outputs.archive_name }}
if-no-files-found: error
release:
name: Create Release
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/quickmark-server@')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Organize archives and changelog
run: |
mkdir -p release-archives
# Copy tar.gz archives from artifact subdirectories
for artifact_dir in artifacts/quickmark-server-*; do
if [ -d "$artifact_dir" ]; then
cp "$artifact_dir"/*.tar.gz release-archives/ 2>/dev/null || true
fi
done
- name: Install cargo tools
uses: taiki-e/install-action@v2
with:
tool: cargo-release,git-cliff
- name: Generate changelog
id: changelog
run: |
changelog=$(./scripts/latest-changes.sh quickmark-server)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$changelog" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: release-archives/*
body: ${{ steps.changelog.outputs.content }}
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}