From 36156913bf5f20592857f40ab1e2600cf29c0b47 Mon Sep 17 00:00:00 2001 From: CodedThemes <77041536+phoenixcoded20@users.noreply.github.com> Date: Thu, 14 Dec 2023 18:43:38 +0530 Subject: [PATCH] Stage (#3) * Create main.yml * Create prod.yml * Update prod.yml * Update package.json --- .github/workflows/main.yml | 44 ++++++++++++++++++++++++++++++++++++++ .github/workflows/prod.yml | 44 ++++++++++++++++++++++++++++++++++++++ package.json | 4 ++-- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/prod.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..910a00b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,44 @@ +name: Stage deploy + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: + - stage* + pull_request: + types: + - closed + branches: + - stage* + +jobs: + if_merged: + if: github.event.pull_request.merged == true + name: 🎉 Deploy + runs-on: ubuntu-latest + + steps: + - name: 🚚 Get latest code + uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: 🔨 Build Project + run: | + npm i + npm run build-stage + + - name: 📂 Deploy to Server + uses: easingthemes/ssh-deploy@v4 + env: + SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }} + # ARGS: "-rltgoDzvO --delete" + SOURCE: "dist/" + REMOTE_HOST: 192.34.62.123 + REMOTE_USER: mantis + TARGET: public_html/vue/free/stage + EXCLUDE: "/node_modules/" diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml new file mode 100644 index 0000000..b21ae57 --- /dev/null +++ b/.github/workflows/prod.yml @@ -0,0 +1,44 @@ +name: Prod deploy + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: + - master + pull_request: + types: + - closed + branches: + - master + +jobs: + if_merged: + if: github.event.pull_request.merged == true + name: 🎉 Deploy + runs-on: ubuntu-latest + + steps: + - name: 🚚 Get latest code + uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: 🔨 Build Project + run: | + npm i + npm run build-prod + + - name: 📂 Deploy to Server + uses: easingthemes/ssh-deploy@v4 + env: + SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }} + # ARGS: "-rltgoDzvO --delete" + SOURCE: "dist/" + REMOTE_HOST: 192.34.62.123 + REMOTE_USER: mantis + TARGET: public_html/vue/free + EXCLUDE: "/node_modules/" diff --git a/package.json b/package.json index a868b4f..6f7318a 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "dev": "vite", "build": "vue-tsc --noEmit && vite build", - "build-stage": "vue-tsc --noEmit && vite build --base=/vue/stage/", - "build-prod": "vue-tsc --noEmit && vite build --base=/vue/", + "build-stage": "vue-tsc --noEmit && vite build --base=/vue/free/stage/", + "build-prod": "vue-tsc --noEmit && vite build --base=/vue/free/", "preview": "vite preview --port 5050", "typecheck": "vue-tsc --noEmit", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"