From 57ca0b30fcdf7b2c33b87e9be2b9cff160b80d36 Mon Sep 17 00:00:00 2001 From: Vincent Vatelot Date: Fri, 30 Dec 2022 17:22:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20ci(deploy):=20Split=20production?= =?UTF-8?q?=20and=20preprod=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-preproduction.yml | 29 +++++++++++++++++++ .../{deploy.yml => deploy-production.yml} | 5 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy-preproduction.yml rename .github/workflows/{deploy.yml => deploy-production.yml} (89%) diff --git a/.github/workflows/deploy-preproduction.yml b/.github/workflows/deploy-preproduction.yml new file mode 100644 index 00000000..b85b5ab2 --- /dev/null +++ b/.github/workflows/deploy-preproduction.yml @@ -0,0 +1,29 @@ +name: Déploiement RSYNC en preproduction + +on: + push: + tags: + - "v*.*.*-preproduction" + +jobs: + deploy: + environment: preproduction + 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 }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-production.yml similarity index 89% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-production.yml index 28779c98..baf8a8ae 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-production.yml @@ -1,12 +1,13 @@ -name: Deploy rsync +name: Déploiement RSYNC en production on: push: tags: - - "v*.*.*" + - "v*.*.*-production" jobs: deploy: + environment: production runs-on: ubuntu-latest steps: - name: 🛒 Checkout