-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (91 loc) · 3.84 KB
/
Copy pathpackage-cpp-release.yml
File metadata and controls
107 lines (91 loc) · 3.84 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
name: Package C++ Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to package'
required: true
default: '1.0.0'
jobs:
package-cpp:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup CMake
uses: lukka/get-cmake@latest
- name: Setup C++ compiler
uses: egor-tensin/setup-gcc@v1
with:
version: 11
platform: x64
- name: Prepare C++ release package
run: |
# Use the existing releases directory structure
echo "Using existing releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }} structure"
# Verify the release package structure exists
if [ ! -d "releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}" ]; then
echo "Error: Release package structure not found in releases/"
exit 1
fi
- name: Build and test package
run: |
cd releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}
# Test the build script if it exists
if [ -f "build.sh" ]; then
chmod +x build.sh
./build.sh
else
# Fallback to manual cmake build from repository root
cd ../../
mkdir -p build_release_test
cd build_release_test
cmake ../packages/cpp -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
fi
- name: Create release archive
run: |
cd releases
tar -czf codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.tar.gz codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/
zip -r codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.zip codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/
- name: Upload release assets
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.tar.gz
releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload workflow artifacts
uses: actions/upload-artifact@v4
if: github.event_name == 'workflow_dispatch'
with:
name: codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}
path: |
releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.tar.gz
releases/codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.zip
validate-package:
needs: package-cpp
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}
- name: Extract and validate
run: |
# Extract tar.gz
tar -xzf codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}.tar.gz
# Check structure
ls -la codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/
# Verify essential files exist
test -f codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/CMakeLists.txt
test -d codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/include
test -d codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/src
test -d codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/examples
test -f codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/build.sh
test -f codeuchain-cpp-${{ github.event.inputs.version || '1.0.0' }}/USAGE.md
echo "✅ Package structure validated successfully!"