chore: refactor agent/tool views #54
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: Build and Push Docker Image | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
compile-client: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: client | |
fetch-depth: 2 | |
- name: Check for changes in client or Dockerfile | |
id: check-changes | |
run: | | |
echo "changed=$(git diff --quiet HEAD^ HEAD client/ Dockerfile || echo true)" >> $GITHUB_OUTPUT | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- name: Cache node modules | |
id: cache-node | |
uses: actions/cache@v4 | |
with: | |
path: ./client/node_modules | |
key: node_modules-${{ runner.os }}-node-${{ hashFiles('./client/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install client dependencies | |
if: steps.cache-node.outputs.cache-hit != 'true' && ${{steps.check-changes.outputs.changed}} == 'true' | |
working-directory: client | |
run: npm install --legacy-peer-deps | |
- name: Cache artifacts | |
id: cache-artifacts | |
uses: actions/cache@v4 | |
with: | |
path: ./client/dist | |
key: dist-${{ hashFiles('./client/package.json') }}-${{ hashFiles('./client/src/**') }}-${{ runner.os }} | |
restore-keys: | | |
${{ runner.os }}-dist- | |
- name: Compile client | |
if: steps.cache-artifacts.outputs.cache-hit != 'true' || ${{steps.check-changes.outputs.changed}} == 'true' | |
# `expo export -p web` always fails on first run | |
# this seems to be related to nativewind compilation. | |
# it adds a file to the node_modules cache after the process begins | |
# then the process doesnt recognize that file and fails. | |
# this issue does not happen after that file is generated | |
# This typically works in one pass if node_modules are cached. | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 2 | |
command: | | |
cd client | |
npm run export | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./client/dist | |
compile-server: | |
runs-on: ubuntu-latest | |
needs: compile-client | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./client/dist | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: downcase REPO | |
id: repo_name | |
run: | | |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "$GITHUB_OUTPUT" | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
push: true | |
tags: ${{steps.repo_name.outputs.REPO}}:latest |