-
Notifications
You must be signed in to change notification settings - Fork 4.3k
172 lines (154 loc) · 4.74 KB
/
build-release.yml
File metadata and controls
172 lines (154 loc) · 4.74 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
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build and Release Skynet
on:
push:
branches: [ master ]
tags: [ 'v*' ]
permissions:
contents: write
actions: read
jobs:
build:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- platform: windows
os: ubuntu-latest
container: debian:13
target: mingw
artifact: skynet-windows.zip
- platform: linux
os: ubuntu-latest
container: debian:13
target: linux
artifact: skynet-linux.zip
- platform: macosx
os: macos-latest
target: macosx
artifact: skynet-macosx.zip
- platform: freebsd
os: ubuntu-latest
container: debian:13
target: freebsd
artifact: skynet-freebsd.zip
container: ${{ matrix.container }}
steps:
- name: Install dependencies (Debian - Windows/Linux)
if: matrix.container == 'debian:13'
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
make \
pkg-config \
mingw-w64 \
mingw-w64-tools \
mingw-w64-i686-dev \
mingw-w64-x86-64-dev \
autoconf \
automake \
libtool \
git \
zip \
ca-certificates \
curl \
libreadline-dev \
libedit-dev \
rsync
- name: Install dependencies (macOS)
if: matrix.platform == 'macosx'
run: |
# macOS usually has most build tools pre-installed
# Install any additional dependencies if needed
brew install autoconf automake libtool || true
- name: Install dependencies (FreeBSD)
if: matrix.platform == 'freebsd'
run: |
# FreeBSD build using standard build tools (cross-compilation compatible)
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
make \
pkg-config \
autoconf \
automake \
libtool \
git \
zip \
ca-certificates \
curl \
libreadline-dev \
libedit-dev \
rsync
- name: Update CA certificates (Debian containers)
if: matrix.container == 'debian:13'
run: |
update-ca-certificates
- name: Configure Git SSL (Debian containers)
if: matrix.container == 'debian:13'
run: |
git config --global http.sslverify true
git config --global http.sslcainfo /etc/ssl/certs/ca-certificates.crt
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 1
- name: Build ${{ matrix.platform }}
run: |
make cleanall
make ${{ matrix.target }}
- name: Prepare build files
run: |
mkdir -p build-output
# Copy all files except .git and .github with ignore-errors flag
- name: Clean and recreate directory
run: |
rm -rf build-output/
mkdir -p build-output/
- name: Sync files to build-output excluding specific directories
run: |
rsync -av --ignore-errors --exclude='.git*' --exclude='.github' --exclude='build-output' . build-output/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: build-output/
retention-days: 30
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release-assets
# Copy zip files from artifact directories to release assets
for artifact in skynet-windows.zip skynet-linux.zip skynet-macosx.zip skynet-freebsd.zip; do
if [ -d "artifacts/${artifact}" ]; then
# The artifacts are already organized, just copy them
cp -r "artifacts/${artifact}/"* "release-assets/" 2>/dev/null || true
# Or if we want to create new zip files with consistent naming
platform=$(echo ${artifact} | sed 's/skynet-\(.*\)\.zip/\1/')
cd "artifacts/${artifact}"
zip -r "../../release-assets/skynet-${platform}.zip" .
cd ../..
fi
done
ls -la release-assets/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release-assets/*.zip
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}