dev-to-prod #417
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
# ╭──────────────────────────────────────────────────────────────────╮ | |
# │ 🐙 GITHUB ACIONS CI/CD WORKFLOW │ | |
# ┣──────────────────────────────────────────────────────────────────┫ | |
# │ Responsible for: │ | |
# │ ➤ [1] build check of project as a Docker Image │ | |
# │ ➤ [2] build check of project as a Check PR Label │ | |
# ╰──────────────────────────────────────────────────────────────────╯ | |
name: '🔍 Pull-Request Check [main]' | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- reopened | |
- labeled | |
- unlabeled | |
- synchronize | |
env: | |
DOCKER_IMAGE: 'scores_web' | |
jobs: | |
# ╭──────────────────────────────────────────────────────────────────╮ | |
# │ NOTE: │ | |
# │ ➤ [1] check for correct build(s) │ | |
# ╰──────────────────────────────────────────────────────────────────╯ | |
npm-build-check: | |
name: 🪀 NPM Build Check | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.19.0 | |
- name: '🏗️ Set npm version' | |
run: | | |
npm install -g npm@10.2.3 | |
- name: 'create .env' | |
run: | | |
echo ${{ secrets.ENV_FILE }} | base64 -d > .env | |
- name: '🟩 Build npm' | |
env: | |
NODE_OPTIONS: "--max-old-space-size=8192" | |
run: | | |
npm ci | |
npm run build | |
# docker-image-build: | |
# needs: npm-build-check | |
# name: 🐳 Docker Image Build | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Build docker image | |
# run: | | |
# docker build . --file ./docker/prod.Dockerfile --tag ${{ env.DOCKER_IMAGE }}:$(date +%s) | |
# ╭──────────────────────────────────────────────────────────────────╮ | |
# │ NOTE: │ | |
# │ ➤ [2] check for correct PR Label │ | |
# ╰──────────────────────────────────────────────────────────────────╯ | |
check-labels: | |
name: 'Check PR Labels' | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mheap/github-action-required-labels@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
mode: exactly | |
count: 1 | |
labels: 'semver:major, semver:minor, semver:patch' |