-
Notifications
You must be signed in to change notification settings - Fork 8
51 lines (41 loc) · 1.69 KB
/
deploy.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
name: Deploy Index
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install stuff
run: sudo apt-get update && sudo apt-get install --assume-yes --no-install-recommends g++-aarch64-linux-gnu
- name: Setup env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Install rust
run: |
rustup toolchain install stable --profile minimal
rustup target add aarch64-unknown-linux-gnu
- name: Setup cache
uses: Swatinem/rust-cache@v2
- name: Build
id: build
run: |
cargo build --release --target aarch64-unknown-linux-gnu
- name: Create ssh key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.INDEX_SERVER }} > ~/.ssh/known_hosts
if: steps.build.outcome == 'success'
- name: Upload target to server
id: upload
run: |
rsync -avz ./target/aarch64-unknown-linux-gnu/release/geode-index ${{ secrets.INDEX_USER }}@${{ secrets.INDEX_SERVER }}:${{ secrets.INDEX_COPY_LOCATION }}
rsync -avzr ./migrations ${{ secrets.INDEX_USER }}@${{ secrets.INDEX_SERVER }}:${{ secrets.MIGRATIONS_COPY_LOCATION }}
if: steps.build.outcome == 'success'
- name: Run update script
run: |
ssh ${{ secrets.INDEX_USER }}@${{ secrets.INDEX_SERVER }} "cd ${{ secrets.INDEX_UPDATE_SCRIPT_PATH }} && ./update.sh"
if: steps.build.outcome == 'success' && steps.upload.outcome == 'success'