Werking on deploys #8
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 and deploy rust graphql server | |
on: | |
push: | |
branches: | |
- main | |
env: | |
SQLX_OFFLINE: true | |
jobs: | |
build: | |
runs-on: self-hosted | |
environment: prod | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Deploy | |
working-directory: ./cookingd-server | |
run: | | |
cd ~ | |
docker-compose down | |
docker-compose build | |
docker-compose up -d |