-
Notifications
You must be signed in to change notification settings - Fork 2
149 lines (128 loc) · 5.29 KB
/
release-build.yml
File metadata and controls
149 lines (128 loc) · 5.29 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
name: Build and Release
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
asset: psmoveapi-4.0.12-linux.tar.gz
executable: dsu_server_psmove
- os: macos-13
asset: psmoveapi-4.0.12-macos.tar.gz
executable: dsu_server_psmove
- os: windows-latest
asset: psmoveapi-4.0.12-windows-msvc2017-x64.zip
executable: dsu_server_psmove.exe
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libbluetooth-dev pkg-config
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install libusb
- name: Download psmoveapi (Linux/macOS)
if: runner.os != 'Windows'
run: |
curl -L -o psmoveapi.${{ matrix.asset }} \
https://github.com/thp/psmoveapi/releases/download/4.0.12/${{ matrix.asset }}
- name: Download psmoveapi (Windows)
if: runner.os == 'Windows'
run: |
curl -L -o psmoveapi.${{ matrix.asset }} https://github.com/thp/psmoveapi/releases/download/4.0.12/${{ matrix.asset }}
- name: Extract psmoveapi (Linux)
if: runner.os == 'Linux'
run: |
mkdir -p psmoveapi_install
tar -xzf psmoveapi.${{ matrix.asset }} -C psmoveapi_install --strip-components=1
- name: Extract psmoveapi (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p psmoveapi_install
tar -xzf psmoveapi.${{ matrix.asset }} -C psmoveapi_install --strip-components=1
- name: Extract psmoveapi (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p psmoveapi_install
tar -xf psmoveapi.${{ matrix.asset }} -C psmoveapi_install --strip-components=1
- name: Configure with CMake (Windows)
if: runner.os == 'Windows'
run: cmake -S . -B build -DPSMOVE_ROOT=${{ github.workspace }}/psmoveapi_install
- name: Configure with CMake (Linux/macOS)
if: runner.os != 'Windows'
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DPSMOVE_ROOT=${{ github.workspace }}/psmoveapi_install
- name: Build
run: cmake --build build --config Release
- name: List build directory contents (debug)
run: |
echo "Contents of build directory:"
ls -la build/
if [ "${{ runner.os }}" = "Windows" ]; then
echo "Contents of build/Release directory:"
ls -la build/Release/ || echo "build/Release/ does not exist"
echo "Contents of build/Debug directory:"
ls -la build/Debug/ || echo "build/Debug/ does not exist"
fi
shell: bash
- name: Find and rename executable
id: artifact
run: |
mkdir -p artifacts
if [ "${{ runner.os }}" = "Windows" ]; then
# Try multiple possible locations for Windows executable
if [ -f "build/Release/${{ matrix.executable }}" ]; then
EXEC_PATH="build/Release/${{ matrix.executable }}"
elif [ -f "build/Debug/${{ matrix.executable }}" ]; then
EXEC_PATH="build/Debug/${{ matrix.executable }}"
elif [ -f "build/${{ matrix.executable }}" ]; then
EXEC_PATH="build/${{ matrix.executable }}"
else
echo "ERROR: Could not find Windows executable"
exit 1
fi
ARTIFACT_NAME="dsu_server_psmove-windows-x64.exe"
elif [ "${{ runner.os }}" = "macOS" ]; then
EXEC_PATH="build/${{ matrix.executable }}"
ARTIFACT_NAME="dsu_server_psmove-macos"
else
EXEC_PATH="build/${{ matrix.executable }}"
ARTIFACT_NAME="dsu_server_psmove-linux"
fi
echo "name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
echo "path=$EXEC_PATH" >> $GITHUB_OUTPUT
# Copy to artifacts directory
cp "$EXEC_PATH" "artifacts/$ARTIFACT_NAME"
echo "Successfully created: artifacts/$ARTIFACT_NAME"
shell: bash
- name: Upload to release (on release event)
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: artifacts/${{ steps.artifact.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest release (on workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
id: latest_release
run: |
LATEST_RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq '.id')
echo "release_id=$LATEST_RELEASE" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to latest release (on workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
gh release upload ${{ steps.latest_release.outputs.release_id }} \
"artifacts/${{ steps.artifact.outputs.name }}" \
--repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}