ci: adapt for pull_request hook
All checks were successful
Deploy workflow / deploy (push) Successful in 31s

This commit is contained in:
Matthieu Bessat 2024-12-23 00:15:24 +01:00
parent 94b1d82047
commit b622a9b57d

View file

@ -8,6 +8,8 @@ on:
branches: branches:
- master - master
- develop - develop
pull_request:
types: [opened, synchronize, reopened]
jobs: jobs:
deploy: deploy:
@ -15,21 +17,24 @@ jobs:
container: container:
image: code.forgejo.org/oci/node:20-bookworm image: code.forgejo.org/oci/node:20-bookworm
steps: steps:
- name: Install rsync and bash
run: apt update && apt install -y rsync bash
- name: Set baseURL - name: Set baseURL
shell: /bin/bash
run: | run: |
if [[ "${{ env.github_ref_name }}" == "master" ]]; then echo "Checking current branch."
echo -n "https://dev.etoiledebethleem.fr" > /base_url.txt
if [ "${{ env.github_ref_name }}" = "master" ]
then
echo "Using master config" echo "Using master config"
echo -n "https://etoiledebethleem.fr" > /base_url.txt echo -n "https://etoiledebethleem.fr" > /base_url.txt
fi fi
if [[ "${{ env.github_ref_name }}" == "develop" ]]; then if [ "${{ env.github_ref_name }}" = "develop" ]
then
echo "Using develop config" echo "Using develop config"
echo -n "https://preview.etoiledebethleem.fr" > /base_url.txt echo -n "https://preview.etoiledebethleem.fr" > /base_url.txt
fi fi
ls / ls -la /base_url.txt
cat /base_url.txt cat /base_url.txt
- name: Install rsync
run: apt update && apt install -y rsync
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
@ -57,8 +62,13 @@ jobs:
REMOTE_USER: forgejo_actions_websites REMOTE_USER: forgejo_actions_websites
SRV_HOST: srv06.lefuturiste.fr SRV_HOST: srv06.lefuturiste.fr
run: | run: |
if [ "${{ env.github_ref_name }}" = "master" ] || [ "${{ env.github_ref_name }}" = "develop" ]
then
echo "Deploying to $REMOTE_USER@$SRV_HOST:$OUTPUT_PATH$GITHUB_REF_NAME"
rsync --perms --archive --stats \ rsync --perms --archive --stats \
-e 'ssh -i ~/.ssh/id_edsa -o StrictHostKeyChecking=no' ./public \ -e 'ssh -i ~/.ssh/id_edsa -o StrictHostKeyChecking=no' ./public \
$REMOTE_USER@$SRV_HOST:$OUTPUT_PATH$GITHUB_REF_NAME $REMOTE_USER@$SRV_HOST:$OUTPUT_PATH$GITHUB_REF_NAME
else
echo "Deployment skipped."
fi