release: v1.8.2 #16
Workflow file for this run
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: Build and Push Site Docker Image | |
| on: | |
| push: | |
| tags: ['v*'] | |
| paths: | |
| - 'site/**' | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: graph-memory/graphmemory-site | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest | |
| type=sha,prefix= | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./site | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| deploy: | |
| needs: build-and-push | |
| runs-on: [self-hosted, graphmemory, site] | |
| permissions: | |
| packages: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Deploy | |
| run: | | |
| docker compose -p graphmemory-site -f site/docker-compose.yml pull | |
| docker compose -p graphmemory-site -f site/docker-compose.yml up -d | |
| env: | |
| SITE_IMAGE: ${{ needs.build-and-push.outputs.image }} | |
| SITE_LISTEN: ${{ vars.SITE_LISTEN }} | |
| - name: Cleanup old images | |
| run: | | |
| docker images ghcr.io/graph-memory/graphmemory-site \ | |
| --format "{{.ID}} {{.Tag}}" \ | |
| | grep -v 'latest' \ | |
| | awk '{print $1}' \ | |
| | xargs -r docker rmi || true |