-
-
Notifications
You must be signed in to change notification settings - Fork 346
133 lines (114 loc) · 4.69 KB
/
main.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
# TODO
# https://github.com/Uriopass/Egregoria/blob/master/.github/workflows/release.yml
# has stuff for automating releases
name: Build
on: [push]
defaults:
run:
shell: bash
jobs:
build:
name: Build everything for ${{ matrix.os }}
if: "contains(github.event.head_commit.message, '[rebuild]')"
environment: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-20.04
- build: macos
os: macos-latest
- build: windows
os: windows-latest
steps:
- uses: actions/checkout@master
- uses: hecrj/setup-rust-action@v1
with:
rust-version: 1.71.0
- name: Cache build
uses: actions/cache@v2
with:
path: target
# The key could include hashFiles('Cargo.lock'), but cargo will figure out what can be reused.
key: build-${{ matrix.os }}
- name: Detect release
run: if [[ `git log -1 --pretty=format:"%s"` == *"[release]"* ]]; then echo 'features=--features=map_gui/release_s3' >> $GITHUB_ENV; else echo 'features=' >> $GITHUB_ENV; fi
- name: Install dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libpango1.0-dev libgtk-3-dev
- name: Build game
working-directory: apps/game
run: cargo build --release ${{ env.features }}
- name: Build santa
working-directory: apps/santa
run: cargo build --release ${{ env.features }}
- name: Build fifteen_min
working-directory: apps/fifteen_min
run: cargo build --release ${{ env.features }}
- name: Build osm_viewer
working-directory: apps/osm_viewer
run: cargo build --release ${{ env.features }}
- name: Build parking_mapper
working-directory: apps/parking_mapper
run: cargo build --release ${{ env.features }}
- name: Build ltn
working-directory: apps/ltn
run: cargo build --release ${{ env.features }}
- name: Build the CLI tool
run: cargo build --release --bin cli
- name: Download system data
run: cargo run --release --bin updater -- download --minimal
- name: import and unlock macos codesigning keychain
if: matrix.build == 'macos'
run: |
echo "${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_P12 }}" | base64 --decode > developerID_application.p12
# The keychain api requires a password, but we're building a one-off keychain
# and immediately unlocking it, so we just use a random throw away password.
KEYCHAIN_PASSWORD=$(openssl rand -hex 64)
security create-keychain -p "${KEYCHAIN_PASSWORD}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" build.keychain
security import developerID_application.p12 -k build.keychain -P "${{ secrets.MACOS_DEVELOPER_ID_APPLICATION_P12_PASSWORD }}" -T /usr/bin/codesign
# avoid being "prompted" for password when using codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${KEYCHAIN_PASSWORD}" build.keychain > /dev/null
rm developerID_application.p12
- name: Package release
env:
MACOS_DEVELOPER_APPLE_ID: ${{ secrets.MACOS_DEVELOPER_APPLE_ID }}
MACOS_DEVELOPER_APP_SPECIFIC_PASSWORD: ${{ secrets.MACOS_DEVELOPER_APP_SPECIFIC_PASSWORD }}
MACOS_DEVELOPER_TEAM_ID: ${{ secrets.MACOS_DEVELOPER_TEAM_ID }}
run: ./release/build.sh ${{ matrix.os }}
- name: Upload release for Linux
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v2
with:
name: abst_linux
path: abst_linux.zip
- name: Upload release for Mac
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: abst_mac
path: abst_mac.zip
- name: Upload release for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: abst_windows
path: abst_windows
- name: Upload just the binary for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: abst_windows_binary
path: target/release/game.exe
- name: Upload just the binary for Mac
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: abst_mac_binary
path: target/release/game