Skip to content

Merge commit '6f25189ad6ec6ab567835689f205952756c13bf6' into translat… #70

Merge commit '6f25189ad6ec6ab567835689f205952756c13bf6' into translat…

Merge commit '6f25189ad6ec6ab567835689f205952756c13bf6' into translat… #70

Workflow file for this run

name: RSYNC Deploy
on:
push:
tags:
- "v*.*.*"
jobs:
env:
name: Get deploy environment based on tag suffix
runs-on: ubuntu-latest
outputs:
target-env: ${{ steps.get_environment.outputs.target-env }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
- 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
fi
deploy:
needs: env
environment:
name: ${{ needs.env.outputs.target-env }}
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
- name: ✨ Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
- name: ✨ Setup NPM
uses: bahmutov/npm-install@v1
- name: 🛠️ Build
run: hugo
- name: 🔑 Install SSH Key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
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 }}