33 lines
1.3 KiB
YAML
33 lines
1.3 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_USER: web-deploy
|
|
DEPLOY_SERVER: lty.name
|
|
DEPLOY_SERVER_KEY: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBKn1tARbrf+klrF31iN1Q0otmL1AvDDI87kC7HLo5ix
|
|
DEPLOY_SOURCE: dist
|
|
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 config check_update false
|
|
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 ${{ env.DEPLOY_SERVER }} ${{ env.DEPLOY_SERVER_KEY }} > ~/.ssh/known_hosts
|
|
rsync -avz --delete ./${{ env.DEPLOY_SOURCE || 'none' }}/ ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_SERVER }}:web/${{ env.DEPLOY_TARGET || 'none' }}/
|