Merge branch 'main' into dev #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
name: frontend deploy dev | |
on: | |
push: | |
branches: [dev] | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- name: Setup Repository | |
uses: actions/checkout@v3 | |
- name: Setup node with cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Setup environment variables | |
run: | | |
echo "VITE_APP_ENV=prod" > .env | |
- name: Install dependencies | |
run: npm ci | |
- name: Build App | |
run: npm run build | |
- name: Upload frontend build file to artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: FrontendApplication | |
path: dist | |
deploy: | |
needs: build-and-upload | |
runs-on: self-hosted | |
steps: | |
- name: Setup Repository | |
uses: actions/checkout@v3 | |
- name: Download build file from artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: FrontendApplication | |
path: dist | |
- name: Prepare deployment directory | |
run: | | |
rm -rf /var/www/html/* | |
mkdir -p /var/www/html/ | |
- name: Deploy to /var/www/html | |
run: | | |
cp -R dist/* /var/www/html/ | |