-
Notifications
You must be signed in to change notification settings - Fork 2
101 lines (87 loc) · 2.68 KB
/
release.yaml
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
name: Release SpaceBoom
on:
release:
types: [created]
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
output_name: SpaceBoom-linux
- os: macos-latest
output_name: SpaceBoom-macos
- os: windows-latest
output_name: SpaceBoom-windows.exe
steps:
- uses: actions/checkout@v2
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libgl1-mesa-dev libglew-dev libglfw3-dev libopenal-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install cmake ninja glew glfw3 openal-soft
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install cmake ninja
- name: Configure CMake
run: |
mkdir build
cd build
cmake -GNinja ..
- name: Build
run: |
cd build
ninja
- name: Prepare release package
run: |
mkdir release
cp build/OpenGL/OpenGL release/${{ matrix.output_name }}
cp -r OpenGL/res release/res
- name: Create release artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.output_name }}
path: release
upload:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Create release archives
run: |
for dir in */; do
zip -r "${dir%/}.zip" "$dir"
done
- name: Upload release assets
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
const release = await github.rest.repos.getReleaseByTag({
owner,
repo,
tag: process.env.GITHUB_REF.replace('refs/tags/', '')
});
const assets = await fs.readdir('.');
for (const asset of assets) {
if (asset.endsWith('.zip')) {
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: release.data.id,
name: asset,
data: await fs.readFile(asset)
});
}
}