forked from azukaar/Cosmos-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (143 loc) · 5.42 KB
/
Copy pathbuild-release.yml
File metadata and controls
174 lines (143 loc) · 5.42 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
173
174
name: Build and Release Cosmos
on:
push:
branches: [main, dev]
tags: ['v*']
pull_request:
branches: [main, dev]
workflow_dispatch:
inputs:
version_override:
description: 'Override version (e.g., 0.19.1-genieos.1)'
required: false
env:
GO_VERSION: '1.23.2'
NODE_VERSION: '18'
jobs:
build:
runs-on: [self-hosted, Linux, X64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get version
id: version
run: |
if [ -n "${{ github.event.inputs.version_override }}" ]; then
echo "VERSION=${{ github.event.inputs.version_override }}" >> $GITHUB_OUTPUT
else
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
fi
- name: Install frontend dependencies
run: npm ci
- name: Build frontend
run: npm run client-build
- name: Copy update.go to launcher
run: cp src/update.go src/launcher/update.go
- name: Build Go binaries (AMD64)
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/cosmos ./src/*.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/cosmos-launcher ./src/launcher/launcher.go ./src/launcher/update.go
- name: Build Go binaries (ARM64)
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o build/cosmos-arm64 ./src/*.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o build/cosmos-launcher-arm64 ./src/launcher/launcher.go ./src/launcher/update.go
- name: Copy assets and package
run: |
# Verify binaries were built
echo "=== Checking build directory ==="
ls -la build/
# Make binaries executable
chmod +x build/cosmos build/cosmos-arm64 build/cosmos-launcher build/cosmos-launcher-arm64
# Copy optional assets (ok to fail)
cp start.sh build/ 2>/dev/null || true
cp -r static build/
cp GeoLite2-Country.mmdb build/ 2>/dev/null || true
cp restic restic-arm nebula nebula-arm nebula-cert nebula-arm-cert Logo.png build/ 2>/dev/null || true
mkdir -p build/images
cp client/src/assets/images/icons/cosmos_gray.png build/cosmos_gray.png 2>/dev/null || true
# Create meta.json
cat > build/meta.json << EOF
{
"version": "${{ steps.version.outputs.VERSION }}",
"buildDate": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"commit": "${{ github.sha }}"
}
EOF
echo "=== Build directory contents ==="
ls -la build/
# Package AMD64 (MUST succeed)
cd build
echo "=== Packaging AMD64 ==="
tar -czvf ../cosmos-genieos-${{ steps.version.outputs.VERSION }}-amd64.tar.gz \
cosmos cosmos-launcher static/ meta.json
# Package ARM64 (MUST succeed)
echo "=== Packaging ARM64 ==="
tar -czvf ../cosmos-genieos-${{ steps.version.outputs.VERSION }}-arm64.tar.gz \
cosmos-arm64 cosmos-launcher-arm64 static/ meta.json
cd ..
echo "=== Generated packages ==="
ls -la cosmos-genieos-*.tar.gz
sha256sum cosmos-genieos-*.tar.gz > checksums.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cosmos-binaries-${{ steps.version.outputs.VERSION }}
path: |
cosmos-genieos-*.tar.gz
checksums.sha256
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: [self-hosted, Linux, X64]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: cosmos-binaries-${{ steps.version.outputs.VERSION }}
path: ./release
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
./release/cosmos-genieos-*.tar.gz
./release/checksums.sha256
generate_release_notes: true
body: |
## Cosmos Server for GenieOS
This release includes Proxmox LXC runtime support alongside Docker.
### Downloads
- **AMD64**: `cosmos-genieos-${{ steps.version.outputs.VERSION }}-amd64.tar.gz`
- **ARM64**: `cosmos-genieos-${{ steps.version.outputs.VERSION }}-arm64.tar.gz`
### Installation
```bash
curl -L https://github.com/namastexlabs/genieos1-cosmos/releases/download/${{ github.ref_name }}/cosmos-genieos-${{ steps.version.outputs.VERSION }}-amd64.tar.gz -o cosmos.tar.gz
tar -xzvf cosmos.tar.gz -C /opt/cosmos/
```
deploy:
needs: release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: [self-hosted, Linux, X64]
steps:
- name: Trigger Jenkins deployment
run: |
curl -sf -X POST "http://10.114.1.103:8080/generic-webhook-trigger/invoke?token=genieos-cosmos" \
-H "Content-Type: application/json" \
-d '{
"action": "deploy",
"tag": "${{ github.ref_name }}",
"repository": "genieos1-cosmos"
}' || echo "Jenkins webhook failed (non-critical)"