Fix CI #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build to DOM Cloud | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
APP_BINARY_PATH: target/release/todo | |
SERVER_HOST: [email protected] | |
jobs: | |
copy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
- uses: Swatinem/rust-cache@v1 | |
- name: Build release binary | |
run: cargo build --release --locked | |
# 1. Install the SSH identifier from action secrets | |
# 2. Kill the app (unlocks the binary for writing) | |
# 3. Copy app binary to server | |
# 4. Also copy static files also needed by the binaries | |
- name: Copy to Remote Server | |
run: >- | |
mkdir -p $HOME/.ssh; (echo "${{ secrets.SSH_KEY }}" > $HOME/.ssh/id_rsa); chmod 0600 $HOME/.ssh/id_rsa; | |
ssh -o StrictHostKeyChecking=no -i $HOME/.ssh/id_rsa ${{ env.SERVER_HOST }} restart; | |
scp -o StrictHostKeyChecking=no -i $HOME/.ssh/id_rsa ${{ env.APP_BINARY_PATH }} ${{ env.SERVER_HOST }}:./public_html; | |
scp -o StrictHostKeyChecking=no -i $HOME/.ssh/id_rsa -r db static migrations Rocket.toml ${{ env.SERVER_HOST }}:./public_html; |