Skip to content

Commit

Permalink
ci: fix deploy get environment (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatelot authored Nov 24, 2023
1 parent 6f25189 commit 168aa5e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: RSYNC Deploy

on:
push:
branches:
- main
tags:
- "v*.*.*"

Expand All @@ -17,10 +19,10 @@ jobs:
- name: 🚀 Get Environment
id: get_environment
run: |
if [[ ${{ github.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$ ]]; then
echo "target-env: preproduction" > $GITHUB_OUTPUT
elif [[ ${{ github.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "target-env: production" > $GITHUB_OUTPUT
if [[ ${{ github.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "target-env=production" > $GITHUB_OUTPUT
else
echo "target-env=preproduction" > $GITHUB_OUTPUT
fi
deploy:
Expand All @@ -45,4 +47,6 @@ jobs:
echo "${{ secrets.RSYNC_PRIVATE_SSH_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.RSYNC_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
- name: 🚀 Deploy
run: rsync -rpzv --exclude="screenshots" -e 'ssh -p ${{ secrets.RSYNC_REMOTE_PORT }}' './public/' ${{ secrets.RSYNC_REMOTE_USER }}@${{ secrets.RSYNC_REMOTE_HOST }}:${{ secrets.RSYNC_REMOTE_FOLDER }}
run: |
echo "Deploying to ${{ needs.env.outputs.target-env }}" >> $GITHUB_STEP_SUMMARY
rsync -rpzv --exclude="screenshots" -e 'ssh -p ${{ secrets.RSYNC_REMOTE_PORT }}' './public/' ${{ secrets.RSYNC_REMOTE_USER }}@${{ secrets.RSYNC_REMOTE_HOST }}:${{ secrets.RSYNC_REMOTE_FOLDER }}

0 comments on commit 168aa5e

Please sign in to comment.