Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Zafei-Erin/NFT_MKP
Browse files Browse the repository at this point in the history
  • Loading branch information
Zafei-Erin committed Feb 22, 2024
2 parents 87d5ccc + b3d79c8 commit 611ccf8
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 77 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/Backend-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Backend-cd

on:
pull_request:
types: [labeled]

jobs:
deploy-git:
if: "${{ github.event.label.name == 'prod: backend' }}"
runs-on: ubuntu-latest

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

- name: Remove deploy label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "prod: backend"

deploy-aws:
needs: deploy-git
runs-on: aws-nft

steps:
- name: stop old image
run: sudo docker-compose stop
- name: remove old image
run: sudo docker-compose rm -f
- name: pull new image
run: sudo docker-compose pull
- name: run new image
run: sudo docker-compose up -d
- name: prune images
run: sudo docker image prune -af
64 changes: 64 additions & 0 deletions .github/workflows/Backend-ci .yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Backend-ci

on:
push:
branches: [main]
paths: "backend/**"
pull_request:
types: [opened, synchronize, reopened]
paths: "backend/**"

jobs:
git-ci:
runs-on: ubuntu-latest

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

- name: Remove deploy label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "deploy: backend"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
cache-dependency-path: "backend/package-lock.json"

- name: Install deps
run: npm install
working-directory: "backend"

- name: Run ci
run: npm ci
working-directory: "backend"

docker-push:
needs: git-ci
runs-on: ubuntu-latest

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

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: print location
run: pwd

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/nft-mkp-api:latest
19 changes: 12 additions & 7 deletions .github/workflows/ci.yaml → .github/workflows/Frontend-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
name: CI
name: Frontend-ci

on:
push:
branches: [main]
paths: 'frontend/**'
pull_request:
types: [opened, synchronize, reopened]
paths: 'frontend/**'

jobs:
test:
git-ci:
runs-on: ubuntu-latest
strategy:
matrix: { dir: ["backend", "frontend", "smart_contract"] }

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

- name: Remove deploy label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "deploy: frontend"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
cache-dependency-path: "**/package-lock.json"
cache-dependency-path: "frontend/package-lock.json"

- name: Install deps
run: npm install
working-directory: ${{ matrix.dir }}
working-directory: "frontend"

- name: Run ci
run: npm ci
working-directory: ${{ matrix.dir }}
working-directory: "frontend"
35 changes: 0 additions & 35 deletions .github/workflows/production.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/staging.yml

This file was deleted.

1 change: 1 addition & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ app.use(errorHandler);
app.use(router);

app.listen(port, () => console.log(`Server running on port ${port}`));

1 change: 1 addition & 0 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
</BrowserRouter>
</React.StrictMode>
);

0 comments on commit 611ccf8

Please sign in to comment.