-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7468902
commit 6e6a56d
Showing
1 changed file
with
49 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,55 @@ | ||
name: Deploy Frontend To Nginx Test | ||
|
||
on: | ||
push: | ||
branches: [ "FE/main" ] | ||
push: | ||
branches: ["FE/main"] | ||
|
||
workflow_dispatch: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.5.1 | ||
|
||
- name: Check Node v | ||
run: node -v | ||
|
||
- name: Install dependencies | ||
working-directory: ./front | ||
run: npm install | ||
|
||
- name: Generate build | ||
working-directory: ./front | ||
run: npm run build | ||
|
||
- name: List contents of ./front/dist | ||
run: ls -la ./front/dist | ||
|
||
- name: Remove build folder in the server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
script: | | ||
rm -rf /usr/share/nginx/build | ||
- name: Deploy to Server | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
# key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
password: ${{ secrets.SERVER_PASSWORD }} | ||
source: front/dist | ||
target: /usr/share/nginx/build | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.5.1 | ||
|
||
- name: Check Node v | ||
run: node -v | ||
|
||
- name: Install dependencies | ||
working-directory: ./front | ||
run: npm install | ||
|
||
- name: .env init | ||
working-directory: ./front | ||
run: echo VITE_APP_SENTRY_DSN = ${{ secrets.SENTRY_DSN }} >> .env | ||
|
||
- name: Generate build | ||
working-directory: ./front | ||
run: npm run build | ||
|
||
- name: List contents of ./front/dist | ||
run: ls -la ./front/dist | ||
|
||
- name: Remove build folder in the server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
script: | | ||
rm -rf /usr/share/nginx/build | ||
- name: Deploy to Server | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
# key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
password: ${{ secrets.SERVER_PASSWORD }} | ||
source: front/dist | ||
target: /usr/share/nginx/build |