-
-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (150 loc) · 5.81 KB
/
Copy pathrelease.yml
File metadata and controls
151 lines (150 loc) · 5.81 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
# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: 2025 hyperpolymath
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v1.0.0)'
required: true
permissions: read-all
env:
CARGO_TERM_COLOR: always
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
jobs:
build-binaries:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: false
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b # stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build with cross
if: matrix.cross
run: cross build --release --package vext-core --target ${{ matrix.target }}
- name: Build with cargo
if: ${{ !matrix.cross }}
run: cargo build --release --package vext-core --target ${{ matrix.target }}
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
tar -czvf vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.tar.gz vextd vext-send 2>/dev/null || tar -czvf vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.tar.gz vextd
sha256sum vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.tar.gz > vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.tar.gz.sha256
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
Compress-Archive -Path vextd.exe,vext-send.exe -DestinationPath vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.zip -ErrorAction SilentlyContinue
if (-not (Test-Path vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.zip)) {
Compress-Archive -Path vextd.exe -DestinationPath vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.zip
}
Get-FileHash vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.zip -Algorithm SHA256 | ForEach-Object { "$($_.Hash.ToLower()) vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.zip" } | Out-File -FilePath vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.zip.sha256
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4
with:
name: vext-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/vext-${{ env.RELEASE_TAG }}-${{ matrix.target }}.*
build-deb:
name: Build .deb package
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b # stable
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build .deb
run: cargo deb --package vext-core
- name: Upload .deb
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4
with:
name: deb-package
path: target/debian/*.deb
build-rpm:
name: Build .rpm package
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@6d9817901c499d6b02debbb57edb38d33daa680b # stable
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm
- name: Build binary
run: cargo build --release --package vext-core
- name: Strip binaries
run: |
strip target/release/vextd
strip target/release/vext-send || true
- name: Build .rpm
run: cargo generate-rpm --package vext-core
- name: Upload .rpm
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4
with:
name: rpm-package
path: target/generate-rpm/*.rpm
release:
name: Create Release
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [build-binaries, build-deb, build-rpm]
permissions:
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
path: artifacts
- name: Collect release assets
run: |
mkdir -p release
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.sha256" -o -name "*.deb" -o -name "*.rpm" \) -exec cp {} release/ \;
ls -la release/
- name: Create Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v2
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
files: release/*
generate_release_notes: true
draft: false