From 4e07ea1478655283e0811df76017c6ba377786f7 Mon Sep 17 00:00:00 2001 From: Thomas Lamant Date: Mon, 15 May 2023 21:38:43 +0200 Subject: [PATCH] build: create ci-cd Github Action --- .github/workflows/CI-CD.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/CI-CD.yml diff --git a/.github/workflows/CI-CD.yml b/.github/workflows/CI-CD.yml new file mode 100644 index 0000000..0254c0c --- /dev/null +++ b/.github/workflows/CI-CD.yml @@ -0,0 +1,45 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: CI-CD + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - uses: pnpm/action-setup@v2 + with: + run_install: true + - name: create env file + run: | + touch .env + echo NODE_ENV="production" >> .env + echo NUXT_PUBLIC_SITE_URL="https://www.tmlmt.com" >> .env + - name: Build app + run: pnpm generate + - name: Deploy to Production server + uses: easingthemes/ssh-deploy@main + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + REMOTE_HOST: ${{ secrets.SSH_HOST }} + REMOTE_USER: ${{ secrets.SSH_USER }} + REMOTE_PORT: ${{ secrets.SSH_PORT }} + SOURCE: '.output/public' + TARGET: ${{ secrets.TARGET_DIR }}