-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (78 loc) · 2.81 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
name: deploy
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
name: deploy
runs-on: ${{ matrix.config.os }} # run on different machines
strategy:
fail-fast: false
matrix:
config:
- name: "Windows Latest MinGW"
os: windows-latest
artifact: "sfmlc_windows.zip"
to_pack: SFML-Collection.exe *cover.png *Resources* *.conf *description.txt
build_type: "Release"
cc: "gcc"
cxx: "g++"
archiver: "7z a -r"
generators: "Ninja"
cmake_add: -DBUILD_SHARED_LIBS=OFF
- name: "Linux"
os: ubuntu-latest
artifact: "sfmlc_linux.zip"
to_pack: SFML-Collection *cover.png *Resources* *.conf *description.txt
build_type: "Release"
cc: "gcc"
cxx: "g++"
archiver: "7z a -r"
generators: "Ninja"
steps:
- uses: actions/checkout@v2
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
shell: bash
run: |
choco install ninja cmake
- name: Install dependecies on linux
if: startsWith(matrix.config.os, 'ubuntu')
run: |
sudo apt update
sudo apt install ninja-build libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
- name: Configure
shell: bash
run: |
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
${{ matrix.config.cmake_add }}
- name: Build
shell: bash
run: cmake --build . --config ${{ matrix.config.build_type }}
- name: Pack
shell: bash
run: |
${{ matrix.config.archiver }} ${{ matrix.config.artifact }} ${{ matrix.config.to_pack }}
- name: Upload
shell: bash
run: |
DROPBOX_TOKEN=$(curl https://api.dropbox.com/oauth2/token \
-d refresh_token=${{ secrets.DROPBOX_REFRESH_TOKEN }} \
-d grant_type=refresh_token \
-d client_id=${{ secrets.DROPBOX_APPKEY }}\
-d client_secret=${{ secrets.DROPBOX_APPSECRET }} \
| jq -r ".access_token")
PRETTY_DATE=$(git log -1 --format="%ad" --date=format:"%Y.%m.%d-%T")
COMMIT_NAME=$(git log -1 --format="%s")
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer $DROPBOX_TOKEN" \
--header "Dropbox-API-Arg: {\"path\": \"/builds/$PRETTY_DATE ($COMMIT_NAME)/${{ matrix.config.artifact }}\"}" \
--header "Content-Type: application/octet-stream" \
--data-binary @${{ matrix.config.artifact }}