Update README.md #23
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 weihua | |
on: | |
push: | |
branches: ["master", "actions"] | |
paths: | |
- "backend/pocketbase/**" | |
- ".github/workflows/weihua.yml" | |
pull_request: | |
branches: ["master"] | |
jobs: | |
build-weihua: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build the weihua Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: backend/pocketbase | |
push: false | |
tags: "weihua:latest" | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: | |
Install ssh keys | |
# check this thread to understand why its needed: | |
# <https://stackoverflow.com/a/70447517> | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_rsa | |
echo "${{ secrets.M }}" > ~/.ssh/id_rsa | |
ssh-keyscan -H junction.nyman.dev > ~/.ssh/known_hosts | |
- name: Copy Docker images to server | |
run: | | |
docker save weihua:latest | bzip2 | ssh [email protected] "docker load && cd weihua && docker compose up -d && exit" | |
- name: cleanup | |
run: rm -rf ~/.ssh |