- Adjust workflow trigger to `fr-translation` branch. - Rename deployment job for clarity. - Update deployment script to pull from `fr-translation` branch. - Change deployment directory to `repo-fr`.
51 lines
1.3 KiB
YAML
51 lines
1.3 KiB
YAML
name: Hugo Build and Deploy (FR)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- fr-translation
|
|
pull_request:
|
|
branches:
|
|
- fr-translation
|
|
|
|
jobs:
|
|
test_build:
|
|
name: Build Hugo Site
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: klakegg/hugo:0.111.3-ext-alpine-ci
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Check Hugo Version and Build
|
|
run: |
|
|
hugo version
|
|
hugo --minify
|
|
|
|
deploy:
|
|
name: Deploy to Server (fr-translation)
|
|
runs-on: ubuntu-latest
|
|
needs: test_build
|
|
if: github.ref == 'refs/heads/fr-translation'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup SSH and Deploy
|
|
run: |
|
|
eval "$(ssh-agent -s)"
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
|
chmod 700 ~/.ssh
|
|
ssh-keyscan "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
chmod 644 ~/.ssh/known_hosts
|
|
|
|
ssh -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" 'cd repo-fr && git stash && git pull --force origin fr-translation && ./build.sh'
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
SSH_PORT: ${{ secrets.SSH_PORT }}
|