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 18.x uses: actions/setup-node@v4 with: node-version: 18.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 --frozen-lockfiles - name: Yarn Test run: | cd ./frontend ./compile-less.sh yarn build docker-fe-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - name: Install doctl uses: digitalocean/action-doctl@v2 with: token: ${{ secrets.DO_ACCESS_TOKEN }} - name: Log in to DigitalOcean Container Registry with short-lived credentials run: doctl registry login --expiry-seconds 1200 - name: Log in to GitHub Container Registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - uses: docker/build-push-action@v5 with: context: ./frontend/ file: ./frontend/Dockerfile cache-from: type=gha cache-to: type=gha,mode=max push: false load: true tags: kemkas/kemkas-fe:edge - name: Tag container image run: | docker tag kemkas/kemkas-fe:edge registry.digitalocean.com/kemkas/kemkas-fe:${GITHUB_SHA::8} docker tag kemkas/kemkas-fe:edge ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8} - name: Push image to Container Registry run: | docker push registry.digitalocean.com/kemkas/kemkas-fe:${GITHUB_SHA::8} docker push ghcr.io/${{ github.repository_owner }}/kemkas-frontend:${GITHUB_SHA::8}