Deploy #266
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: Deploy | |
on: workflow_dispatch | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source Code | |
uses: actions/checkout@v4 | |
- name: Get Rust Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-musl | |
- name: Install Musl Tools | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: musl-tools | |
version: 1.0 | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target x86_64-unknown-linux-musl | |
env: | |
SQLX_OFFLINE: true | |
- name: Prepare | |
run: mv target/x86_64-unknown-linux-musl/release/stardb-api . | |
- name: Delete Old File | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: mv stardb-api/stardb-api stardb-api/stardb-api-old | |
- name: Copy New File | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
source: stardb-api | |
target: /root/stardb-api/ | |
- name: Restart Service | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: systemctl restart stardb-api |