-
Notifications
You must be signed in to change notification settings - Fork 12
145 lines (137 loc) · 4.43 KB
/
buildall.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
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
name: GLSMAC autobuild
on:
push:
branches: [ "main" ]
# branches: [ "stable" ]
pull_request:
branches: [ "main" ]
# branches: [ "stable" ]
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
ver: ${{ steps.info.outputs.ver }}
sha: ${{ steps.info.outputs.sha }}
steps:
- uses: benjlevesque/short-sha@v2.1
id: short-sha
with:
length: 7
- uses: dev-drprasad/delete-older-releases@v0.2.0
with:
keep_latest: 5
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: info
id: info
env:
ver: v0.3
sha: ${{ steps.short-sha.outputs.sha }}
run: |
echo ${{ env.ver }} ${{ env.sha }}
echo "ver=${{ env.ver }}" >> $GITHUB_OUTPUT
echo "sha=${{ env.sha }}" >> $GITHUB_OUTPUT
- name: create-release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.info.outputs.ver }}-${{ steps.info.outputs.sha }}
release_name: ${{ steps.info.outputs.ver }}-${{ steps.info.outputs.sha }}
draft: true
prerelease: false
build_linux:
needs: [prepare, finalize]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install_dependencies
run: |
sudo apt-get update
sudo apt-get install libfreetype-dev libsdl2-dev libsdl2-image-dev libglu-dev libglew-dev libossp-uuid-dev libyaml-cpp-dev
- name: prepare
run: |
mkdir build
- name: cmake
working-directory: ./build
run: cmake -DCMAKE_BUILD_TYPE=Portable64 ..
- name: make
working-directory: ./build
run: make
- name: data
working-directory: ./build
run: mv ../GLSMAC_data bin/
- name: pack
working-directory: ./build
run: tar -C bin -zcvf GLSMAC.tar.gz GLSMAC GLSMAC_data
- name: publish
uses: actions/upload-artifact@v3
with:
name: GLSMAC-linux64-bin
path: |
./build/GLSMAC.tar.gz
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.upload_url }}
asset_path: ./build/GLSMAC.tar.gz
asset_name: GLSMAC-${{ needs.prepare.outputs.ver }}-linux64-${{ needs.prepare.outputs.sha }}.tar.gz
asset_content_type: application/gzip
build_windows:
needs: [prepare, finalize]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: install_dependencies
run: |
choco install ninja
- name: prepare
run: |
mkdir build
- name: cmake
working-directory: ./build
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Portable64 -DVENDORED_DEPENDENCIES=1 ..
- name: make
working-directory: ./build
run: ninja
- name: data
working-directory: ./build
run: mv ../GLSMAC_data bin/
- name: pack
working-directory: ./build/bin
run: Compress-Archive -Path GLSMAC.exe,GLSMAC_data -Destination ../GLSMAC.zip
- name: publish
uses: actions/upload-artifact@v3
with:
name: GLSMAC-windows64-bin
path: |
./build/GLSMAC.zip
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.upload_url }}
asset_path: ./build/GLSMAC.zip
asset_name: GLSMAC-${{ needs.prepare.outputs.ver }}-win64-${{ needs.prepare.outputs.sha }}.zip
asset_content_type: application/gzip
finalize:
# needs: [prepare, build_linux, build_windows]
needs: [prepare]
runs-on: ubuntu-latest
steps:
- name: update-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.info.outputs.ver }}-${{ steps.info.outputs.sha }}
release_name: ${{ steps.info.outputs.ver }}-${{ steps.info.outputs.sha }}
on_release_exists: update_only_unreleased_or_skip
draft: false