megabrain.kr 1.0.0 기능 구현 #2
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: Continuous integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Define container metadata before build | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/inje-megabrain/megabrain.kr | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Setup nodejs | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Set up Docker Buildx (Builder instance) | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Container Registry for Image Push | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build Image and Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
platform: linux/amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |