Fix: Isolate Docker RUN layers and fix git detached HEAD in workflow #7
This file contains hidden or 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: Docker Image CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "main" | |
| - "master" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fix detached HEAD | |
| run: | | |
| git fetch --all | |
| git checkout ${{ github.ref_name }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Log in to the GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Convert owner name to lowercase | |
| id: string | |
| uses: vishalmamidi/lowercase-action@v1 | |
| with: | |
| string: ${{ github.repository_owner }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./agents | |
| file: ./agents/Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/${{ steps.string.outputs.lowercase }}/clay-i-agent:latest | |
| ghcr.io/${{ steps.string.outputs.lowercase }}/clay-i-agent:v15 |