Merge pull request #440 from Neogasogaeseo/chore/#439 #26
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
# This is a basic workflow to help you get started with Actions | |
name: Release | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the dev branch | |
push: | |
branches: ["v1.0.1"] | |
paths-ignore: ['**.md'] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
CI: false | |
jobs: | |
deploy-dev: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/[email protected] | |
- name: Set Node.js 16.x | |
uses: actions/[email protected] | |
with: | |
node-version: 16.x | |
- name: Create .env file | |
run: | | |
touch .env | |
echo REACT_APP_CLIENT_ID=${{ secrets.REACT_APP_CLIENT_ID }}\ >> .env | |
cat .env | |
- name: Install Client Dependencies | |
run: yarn | |
- name: Build React App | |
run: yarn build | |
- name: Remove Stale Files | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST_DEV }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT_DEV }} | |
script: | | |
DIR="/home/ubuntu/build" | |
if [ -d "$DIR" ] | |
then | |
rm -rf $DIR | |
fi | |
- name: Copy Build File to Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST_DEV }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT_DEV }} | |
source: './build' | |
target: '/home/ubuntu/' | |
- uses: actions/upload-artifact@v2 | |
if: ${{ failure() && steps.diff.conclusion == 'failure' }} | |
with: | |
name: deploy_dev_branch | |
path: deploy_dev_branch/ |