Skip to content

Commit

Permalink
introduce reactjs branch ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Sep 26, 2024
1 parent c44b7b2 commit a06ade3
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/liara-reactjs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI and CD
on:
push:
branches:
- reactjs
jobs:
ci-backend:
runs-on: ubuntu-latest

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

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'

- name: Run unit tests
run: |
cd ./backend && go test ./... -v -race -cover
cd-backend:
runs-on: ubuntu-latest

needs:
- ci-backend

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: "reactjs"

- uses: actions/setup-node@v3
with:
node-version: "18"

- name: deploy to production
env:
LIARA_TOKEN: ${{ secrets.LIARA_API_TOKEN }}
LIARA_BACKEND_APP_NAME: ${{secrets.LIARA_BACKEND_APP_NAME_REACTJS}}
LIARA_FRONTEND_APP_NAME: ${{secrets.LIARA_FRONTEND_APP_NAME_REACTJS}}
run: |
npm i -g @liara/cli@5
cd ./backend && liara deploy --platform=docker --port="80" --app="$LIARA_BACKEND_APP_NAME" --api-token="$LIARA_TOKEN" --detach
cd-frontend:
runs-on: ubuntu-latest

needs:
- cd-backend

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

- uses: actions/setup-node@v3
with:
node-version: "18"

- name: deploy to production
env:
LIARA_TOKEN: ${{ secrets.LIARA_API_TOKEN }}
LIARA_BACKEND_APP_NAME: ${{secrets.LIARA_BACKEND_APP_NAME_REACTJS}}
LIARA_FRONTEND_APP_NAME: ${{secrets.LIARA_FRONTEND_APP_NAME_REACTJS}}
run: |
npm i -g @liara/cli@5
cd ./frontend && liara deploy --platform=docker --port="3000" --app="$LIARA_FRONTEND_APP_NAME" --api-token="$LIARA_TOKEN" --detach

0 comments on commit a06ade3

Please sign in to comment.