Synchronise le pipeline deploy avec main
This commit is contained in:
@@ -7,6 +7,7 @@ on:
|
|||||||
- beta
|
- beta
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
deploy-main:
|
deploy-main:
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -19,13 +20,37 @@ jobs:
|
|||||||
username: ${{ secrets.SERVER_USER }}
|
username: ${{ secrets.SERVER_USER }}
|
||||||
key: ${{ secrets.SERVER_SSH_KEY }}
|
key: ${{ secrets.SERVER_SSH_KEY }}
|
||||||
script: |
|
script: |
|
||||||
cd ${{ secrets.DEPLOY_PATH }}
|
|
||||||
git fetch origin
|
|
||||||
git reset --hard origin/main
|
|
||||||
|
|
||||||
cd ${{ secrets.DEMO_DEPLOY_PATH }}
|
deploy_force () {
|
||||||
git fetch origin
|
TARGET=$1
|
||||||
git reset --hard origin/main
|
BRANCH=$2
|
||||||
|
|
||||||
|
echo "------ Deploying $BRANCH to $TARGET ------"
|
||||||
|
|
||||||
|
mkdir -p "$TARGET"
|
||||||
|
cd "$TARGET"
|
||||||
|
|
||||||
|
# Si le repo est cassé ou absent → on reclone
|
||||||
|
if [ ! -d ".git" ]; then
|
||||||
|
echo "Repo absent ou cassé → reclone"
|
||||||
|
rm -rf "$TARGET"/*
|
||||||
|
git clone https://github.com/Johnnybegood90/GridTV.git .
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Force la branche
|
||||||
|
git fetch origin
|
||||||
|
|
||||||
|
git checkout -B $BRANCH origin/$BRANCH
|
||||||
|
|
||||||
|
git reset --hard origin/$BRANCH
|
||||||
|
git clean -fd
|
||||||
|
|
||||||
|
echo "Deploy terminé"
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy_force "${{ secrets.DEPLOY_PATH }}" main
|
||||||
|
deploy_force "${{ secrets.DEMO_DEPLOY_PATH }}" main
|
||||||
|
|
||||||
|
|
||||||
deploy-beta:
|
deploy-beta:
|
||||||
if: github.ref == 'refs/heads/beta'
|
if: github.ref == 'refs/heads/beta'
|
||||||
@@ -39,6 +64,28 @@ jobs:
|
|||||||
username: ${{ secrets.SERVER_USER }}
|
username: ${{ secrets.SERVER_USER }}
|
||||||
key: ${{ secrets.SERVER_SSH_KEY }}
|
key: ${{ secrets.SERVER_SSH_KEY }}
|
||||||
script: |
|
script: |
|
||||||
cd ${{ secrets.BETA_DEPLOY_PATH }}
|
|
||||||
git fetch origin
|
deploy_force () {
|
||||||
git reset --hard origin/beta
|
TARGET=$1
|
||||||
|
BRANCH=$2
|
||||||
|
|
||||||
|
echo "------ Deploying $BRANCH to $TARGET ------"
|
||||||
|
|
||||||
|
mkdir -p "$TARGET"
|
||||||
|
cd "$TARGET"
|
||||||
|
|
||||||
|
if [ ! -d ".git" ]; then
|
||||||
|
echo "Repo absent ou cassé → reclone"
|
||||||
|
rm -rf "$TARGET"/*
|
||||||
|
git clone https://github.com/Johnnybegood90/GridTV.git .
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch origin
|
||||||
|
git checkout -B $BRANCH origin/$BRANCH
|
||||||
|
git reset --hard origin/$BRANCH
|
||||||
|
git clean -fd
|
||||||
|
|
||||||
|
echo "Deploy terminé"
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy_force "${{ secrets.BETA_DEPLOY_PATH }}" beta
|
||||||
|
|||||||
Reference in New Issue
Block a user