-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (97 loc) · 3.63 KB
/
deploy.yml
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
name: Create Release
on:
push:
branches: [ main ]
permissions:
contents: write
packages: write
deployments: write
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
asio: [with_asio, no_asio]
configuration: [Debug, Release]
include:
- os: windows-latest
archive_ext: zip
archive_cmd: 7z a
platform: windows
- os: ubuntu-latest
archive_ext: tar.gz
archive_cmd: tar -czf
platform: linux
- os: macos-latest
archive_ext: tar.gz
archive_cmd: tar -czf
platform: macos
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: GekkoLib # Set working directory for all steps
steps:
- uses: actions/checkout@v2
- name: Create build directory
run: cmake -E make_directory build
- name: Configure CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} \
-DBUILD_SHARED_LIBS=ON \
-DNO_ASIO_BUILD=${{ matrix.asio == 'no_asio' && 'ON' || 'OFF' }}
- name: Build
run: cmake --build build --config ${{ matrix.configuration }}
- name: Prepare files for packaging
run: |
mkdir -p package/${{ matrix.configuration }}/lib
mkdir -p package/${{ matrix.configuration }}/include
cp -r include/* package/${{ matrix.configuration }}/include/
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp build/${{ matrix.configuration }}/* package/${{ matrix.configuration }}/lib/ || true
else
cp build/* package/${{ matrix.configuration }}/lib/ || true
fi
shell: bash
- name: Create Windows Archive
if: matrix.os == 'windows-latest'
run: |
cd package
7z a ../GekkoNet-${{ matrix.platform }}-${{ matrix.asio }}-${{ matrix.configuration }}.${{ matrix.archive_ext }} *
- name: Create Unix Archive
if: matrix.os != 'windows-latest'
run: |
cd package
tar -czf ../GekkoNet-${{ matrix.platform }}-${{ matrix.asio }}-${{ matrix.configuration }}.${{ matrix.archive_ext }} *
create_release:
needs: build
runs-on: ubuntu-latest
if: ${{ success() }} # Only proceed if the build job succeeded
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get version
id: version
run: |
echo "version=$(date +'%Y.%m.%d')-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./GekkoNet-${{ matrix.platform }}-${{ matrix.asio }}-${{ matrix.configuration }}.${{ matrix.archive_ext }}
asset_name: GekkoNet-${{ matrix.platform }}-${{ matrix.asio }}-${{ matrix.configuration }}.${{ matrix.archive_ext }}
asset_content_type: ${{ matrix.archive_ext == 'zip' && 'application/zip' || 'application/gzip' }}