7c682373a5
* refactor: use vite instead of CRA * skip deployments for now * local env fixes
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
name: CI compile & test & build
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
ci-fe:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js 24.x
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.x
|
|
- name: Cache NPM packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
key: npm-${{ hashFiles('./frontend/yarn.lock') }}
|
|
path: |
|
|
./frontend/node_modules
|
|
restore-keys: |
|
|
npm-${{ hashFiles('./frontend/yarn.lock') }}
|
|
npm-
|
|
- name: Yarn Install
|
|
run: |
|
|
cd ./frontend
|
|
yarn install
|
|
- name: Yarn Test
|
|
run: |
|
|
cd ./frontend
|
|
yarn run test
|
|
|
|
docker-fe-build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
image_tag: ${{ steps.get_image_tag.outputs.image_tag }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Log in to GitHub Container Registry
|
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
- id: get_image_tag
|
|
run: |
|
|
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
|
|
echo "ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8}"
|
|
echo "image_tag=ghcr.io/${{ github.repository_owner }}/kemkas-fe:${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
|
- uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./frontend/
|
|
file: ./frontend/Dockerfile
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${{ env.GITHUB_SHA_SHORT }}
|
|
|
|
# No longer used, and token expired.
|
|
# deploy-to-beta:
|
|
# runs-on: ubuntu-latest
|
|
# needs:
|
|
# - docker-fe-build
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
# with:
|
|
# repository: ${{ github.repository_owner }}/kemkas-deployment
|
|
# ref: refs/heads/main
|
|
# ssh-key: ${{ secrets.DEPLOYMENT_REPO_DEPLOY_KEY }}
|
|
# - uses: mikefarah/yq@v4
|
|
# with:
|
|
# cmd: yq -i '.spec.template.spec.containers[0].image = "${{ needs.docker-fe-build.outputs.image_tag }}"' ./kemkas-beta/kemkas-fe-deployment.yaml
|
|
# - run: |
|
|
# git config --add user.email "beta-fe-deployment-bot@kemkas.hu"
|
|
# git config --add user.name "Deployment Bot Beta FE"
|
|
# git commit -a -m "deploy ${{ needs.docker-fe-build.outputs.image_tag }}"
|
|
# git push
|