30 lines
1.1 KiB
YAML
30 lines
1.1 KiB
YAML
on: [push, pull_request, workflow_dispatch]
|
|
|
|
name: CI
|
|
jobs:
|
|
deploy:
|
|
name: CI
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GIT_SERVER: devops.lty.name
|
|
DEPLOY_SERVER: copy.lty.name
|
|
DEPLOY_SERVER_KEY: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBKn1tARbrf+klrF31iN1Q0otmL1AvDDI87kC7HLo5ix
|
|
DEPLOY_TARGET: homepage
|
|
steps:
|
|
- name: build
|
|
run: |
|
|
git clone https://${{ github.token }}@${{ env.GIT_SERVER }}/${{ github.repository }} $(pwd)
|
|
git lfs install
|
|
git lfs pull
|
|
pip install --break-system-package pdm==2.20.1
|
|
pdm install
|
|
pdm start
|
|
- name: deploy
|
|
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
|
|
run: |
|
|
apt update && apt install -y rsync
|
|
mkdir -p ~/.ssh && touch ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
|
|
echo ${{ secrets.DEPLOY_SSH_KEY }} | base64 -d > ~/.ssh/id_ed25519
|
|
echo ${{ secrets.DEPLOY_SERVER }} ${{ env.DEPLOY_SERVER_KEY }} > ~/.ssh/known_hosts
|
|
rsync -avz --delete ./dist/ "${DEPLOY_TARGET}:~/${DEPLOY_TARGET}/"
|