Skip to content

Commit

Permalink
Merge pull request #186 from elmadev/github-actions
Browse files Browse the repository at this point in the history
GitHub actions - deploying to server
  • Loading branch information
sunehs authored Jan 25, 2024
2 parents 98dba19 + 5adf3a3 commit 7cb5192
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 11 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deployment-live.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Deploy live

on:
push:
branches:
- master

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: Replace config values
run: |
sed -i "s|https://apitest.elma.online/|${{ secrets.API_URL_LIVE }}|g" config.js
sed -i "s|'test/'|${{ secrets.S3_SUB_FOLDER_LIVE }}|g" config.js
sed -i "s|${url}u/|${{ secrets.UP_LIVE }}|g" config.js
sed -i "s|6Le-n9QUAAAAAG-3bYyysXddxwD6I6iJeDBTHf2r|${{ secrets.RECAPTCHA_LIVE }}|g" config.js
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build project
run: yarn build

- name: Deploy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST_LIVE }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "build/*"
target: "${{ secrets.SSH_BUILD_PATH }}"
strip_components: 1
36 changes: 36 additions & 0 deletions .github/workflows/deployment-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Deploy test

on:
push:
branches:
- dev

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build project
run: yarn build

- name: Deploy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "build/*"
target: "${{ secrets.SSH_BUILD_PATH }}"
strip_components: 1
2 changes: 1 addition & 1 deletion src/pages/level/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import Loading from 'components/Loading';
import Tags from 'components/Tags';
import LevelMap from 'features/LevelMap';
import Link from 'components/Link';
import UpdateForm from 'pages/Level/UpdateForm';
import UpdateForm from 'pages/level/UpdateForm';
import LocalTime from 'components/LocalTime';
import { useNavigate } from '@reach/router';
import config from 'config';
Expand Down
20 changes: 10 additions & 10 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export default defineConfig(() => {
plugins: [react()],
resolve: {
alias: {
components: path.resolve(__dirname, 'src/components'),
images: path.resolve(__dirname, 'src/images'),
pages: path.resolve(__dirname, 'src/pages'),
utils: path.resolve(__dirname, 'src/utils'),
constants: path.resolve(__dirname, 'src/constants'),
api: path.resolve(__dirname, 'src/api'),
globalStyle: path.resolve(__dirname, 'src/globalStyle'),
theme: path.resolve(__dirname, 'src/theme'),
config: path.resolve(__dirname, 'src/config'),
features: path.resolve(__dirname, 'src/features'),
components: '/src/components',
images: '/src/images',
pages: '/src/pages',
utils: '/src/utils',
constants: '/src/constants',
api: '/src/api',
globalStyle: '/src/globalStyle',
theme: '/src/theme',
config: '/src/config',
features: '/src/features',
},
},
optimizeDeps: {
Expand Down

0 comments on commit 7cb5192

Please sign in to comment.