Skip to content

Merge pull request #32 from raferdev/development #44

Merge pull request #32 from raferdev/development

Merge pull request #32 from raferdev/development #44

Workflow file for this run

name: Build and Deploy
concurrency:
group: production
cancel-in-progress: true
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node & Pnpm
uses: pnpm/action-setup@v2
with:
version: 8.9.2
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- name: Create env file
run: |
echo "${{ secrets.ENV_FILE }}" > .env
echo "${{ secrets.ENV_LOCAL_FILE }}" > .env.local
- name: Install Deps
run: pnpm i
- name: Build
run: pnpm run build
- name: Build Storybook
run: pnpm run build.storybook
- name: Upload Landing Page Files
uses: actions/upload-artifact@v3
with:
name: landing-page
path: out
retention-days: 1
- name: Upload Storybook Files
uses: actions/upload-artifact@v3
with:
name: storybook
path: storybook-static
retention-days: 1
deploy:
name: Deploy
runs-on: self-hosted
needs: build
environment:
name: production
url: https://rafer.dev
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Storybook
uses: actions/download-artifact@v3
with:
name: storybook
path: storybook-static
- name: Download Landing Page
uses: actions/download-artifact@v3
with:
name: landing-page
path: out
- name: Filter
uses: dorny/[email protected]
id: filter
with:
filters: |
ngnix:
- '**/*'
- name: Deploy Nginx
if: ${{ steps.filter.outputs.ngnix }} == 'true'
run: |
sudo docker compose -f docker-compose.yaml build --no-cache
sudo docker compose down
sudo docker compose up -d
- name: Update content
run: |
sudo docker cp ./out server:/www/data/
sudo docker cp ./storybook-static server:/www/data/