Skip to content

Commit

Permalink
ci: update script
Browse files Browse the repository at this point in the history
  • Loading branch information
thuongtruong109 committed Dec 22, 2024
1 parent 749ea55 commit 4fd673f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 56 deletions.
108 changes: 53 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
name: Build and Publish
name: CD

on:
push:
branches:
- main
paths-ignore:
- "!.github/**"
- "!app/**"
- "!client/**"
- "!nginx/**"
push:
branches:
- main
paths-ignore:
- '!.github/**'
- '!src/**'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'

- name: Install dependencies
run: npm install
- name: Install dependencies
run: npm install

- name: Lint
run: npm run lint
- name: Lint
run: npm run lint

push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- name: Check out the repo
uses: actions/checkout@v4
steps:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Log in to the registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
- name: Log in to the registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT }}

- name: Extract metadata
id: api
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/shakemate
ghcr.io/${{ github.repository }}
- name: Extract metadata
id: api
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/shakemate
ghcr.io/${{ github.repository }}
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
labels: ${{ steps.api.outputs.labels }}
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
labels: ${{ steps.api.outputs.labels }}
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM node:18-alpine

WORKDIR /app

RUN npm install npm@latest -g
RUN npm install -g typescript

COPY package*.json ./
Expand Down

0 comments on commit 4fd673f

Please sign in to comment.