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