-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (114 loc) · 4.46 KB
/
release.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
113
114
115
116
117
118
119
120
name: Release Pipeline
on:
push:
tags:
- v*
permissions:
pages: write
id-token: write
contents: write
jobs:
release-windows:
name: Build and release for Windows
runs-on: windows-latest
steps:
- name: Install Glfw3
run: |
choco install cmake git
- name: Checkout code
uses: actions/checkout@v2
- name: Set commit hash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$env:GITHUB_SHA")" >> "$env:GITHUB_ENV"
- name: Build and compile
run: |
mkdir build && cd build && cmake .. && cmake --build . --config Release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/Release/json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}.exe
asset_name: json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}.exe
tag: ${{ github.ref }}
release-macos:
name: Build and release for MacOS
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Glfw3
run: |
brew install cmake
- name: Set commit hash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and compile
run: |
mkdir build && cd build && cmake .. && make
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
asset_name: json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
tag: ${{ github.ref }}
release-linux:
name: Build and release for Linux
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Glfw3
run: |
sudo apt-get update
sudo apt-get install libegl1-mesa-dev libwayland-dev libxkbcommon-dev xorg-dev
- name: Set commit hash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and compile
run: |
mkdir build && cd build && cmake .. && make
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
asset_name: json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
tag: ${{ github.ref }}
web-build:
name: Web page build
needs: [release-linux, release-macos, release-windows]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set commit hash
run: |
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Checkout to web branch
uses: actions/checkout@v2
with:
ref: web
- name: Compile HTML
run: |
export LINUX_DOWNLOAD_HREF=https://github.com/sithumonline/json_x/releases/download/${{ github.ref_name }}/json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
export LINUX_DOWNLOAD=json_x_glfw_opengl3-linux-amd64_${{ env.SHA_SHORT }}
export MACOS_DOWNLOAD_HREF=https://github.com/sithumonline/json_x/releases/download/${{ github.ref_name }}/json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
export MACOS_DOWNLOAD=json_x_glfw_opengl3-macos-arm64_${{ env.SHA_SHORT }}
export WINDOWS_DOWNLOAD_HREF=https://github.com/sithumonline/json_x/releases/download/${{ github.ref_name }}/json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}.exe
export WINDOWS_DOWNLOAD=json_x_glfw_opengl3-windows-amd64_${{ env.SHA_SHORT }}
sed -e "s#linux-download-href#$LINUX_DOWNLOAD_HREF#g" \
-e "s#linux-download#$LINUX_DOWNLOAD#g" \
-e "s#macos-download-href#$MACOS_DOWNLOAD_HREF#g" \
-e "s#macos-download#$MACOS_DOWNLOAD#g" \
-e "s#windows-download-href#$WINDOWS_DOWNLOAD_HREF#g" \
-e "s#windows-download#$WINDOWS_DOWNLOAD#g" \
index.html > temp.html
mv temp.html index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "."
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1