-
Notifications
You must be signed in to change notification settings - Fork 4
159 lines (134 loc) · 4.51 KB
/
Copy pathrelease.yml
File metadata and controls
159 lines (134 loc) · 4.51 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
152
153
154
155
156
157
158
159
name: Release
on:
push:
branches: [ main, master ]
tags:
- 'v*'
pull_request:
branches: [ main, master ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: linux-x86_64
# Linux ARM64 (native build on ARM runner)
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04-arm64-4core
name: linux-aarch64
# macOS Apple Silicon (M1/M2/M3)
- target: aarch64-apple-darwin
os: macos-latest
name: macos-aarch64
# Windows x86_64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: windows-x86_64
steps:
- name: Checkout sources
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
with:
target: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package binary (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czf ../../../maple-proxy-${{ matrix.name }}.tar.gz maple-proxy
cd -
echo "ASSET_PATH=maple-proxy-${{ matrix.name }}.tar.gz" >> $GITHUB_ENV
- name: Package binary (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
7z a ../../../maple-proxy-${{ matrix.name }}.zip maple-proxy.exe
cd -
echo "ASSET_PATH=maple-proxy-${{ matrix.name }}.zip" >> $env:GITHUB_ENV
- name: Upload artifact
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: maple-proxy-${{ matrix.name }}
path: ${{ env.ASSET_PATH }}
retention-days: 7
release:
name: Create Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout sources
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Download all artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: artifacts
- name: Generate checksums
run: |
cd artifacts
for dir in */; do
cd "$dir"
for file in *; do
sha256sum "$file" > "$file.sha256"
mv "$file" "$file.sha256" ../
done
cd ..
rmdir "$dir"
done
cd ..
- name: Generate release notes
id: release_notes
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
cat << EOF > release_notes.md
## 🚀 Maple Proxy $VERSION
### Installation
#### 🐳 Docker
\`\`\`bash
docker pull ghcr.io/opensecretcloud/maple-proxy:$VERSION
\`\`\`
#### 📦 Pre-built Binaries
Download the appropriate binary for your platform below.
#### 🔧 From Source
\`\`\`bash
cargo install --git https://github.com/OpenSecretCloud/maple-proxy --tag $VERSION
\`\`\`
### Checksums
All binaries include SHA256 checksums for verification.
### Supported Platforms
- Linux x86_64
- Linux ARM64
- macOS Apple Silicon (M1/M2/M3)
- Windows x86_64
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
name: Release ${{ steps.release_notes.outputs.VERSION }}
body_path: release_notes.md
files: artifacts/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}