diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml new file mode 100644 index 00000000..bf047951 --- /dev/null +++ b/.github/workflows/build-check.yml @@ -0,0 +1,23 @@ +name: Build Check +on: + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install + run: npm ci + + - name: Build + run: npm run build diff --git a/.github/workflows/docker-build-master.yml b/.github/workflows/docker-build-master.yml new file mode 100644 index 00000000..7fa72541 --- /dev/null +++ b/.github/workflows/docker-build-master.yml @@ -0,0 +1,41 @@ +name: Docker Build and Push to DockerHub (main) +env: + DOCKER_CLI_EXPERIMENTAL: enabled + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + name: Build and push graphmindset image + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + steps: + - name: Check out from Git + uses: actions/checkout@v4 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + id: buildx + - name: Cache Docker layers + uses: actions/cache@v4 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Run Docker buildx + run: | + docker buildx build \ + --cache-to "type=local,dest=/tmp/.buildx-cache" \ + --platform linux/amd64 \ + --tag "${{ secrets.DOCKER_HUB_USER }}/graphmindset:master" \ + --output "type=registry" ./ diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 00000000..4cf5f85a --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,77 @@ +name: Docker Build and Push to DockerHub +env: + DOCKER_CLI_EXPERIMENTAL: enabled + +on: + release: + types: [published] + +jobs: + push: + strategy: + matrix: + include: + - platform: linux/amd64 + runner: ubuntu-latest + - platform: linux/arm64 + runner: ubuntu-arm64 + runs-on: ${{ matrix.runner }} + name: Build and push graphmindset image + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + steps: + - name: Check out from Git + uses: actions/checkout@v4 + - name: Set release tag + run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + id: buildx + - name: Show available buildx platforms + run: echo ${{ steps.buildx.outputs.platforms }} + - name: Cache Docker layers + uses: actions/cache@v4 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.platform }} + restore-keys: | + ${{ runner.os }}-buildx-${{ matrix.platform }}- + - name: Run Docker buildx + run: | + PLATFORM_TAG=$(echo ${{ matrix.platform }} | tr '/' '-') + docker buildx build \ + --platform ${{ matrix.platform }} \ + --tag "${{ secrets.DOCKER_HUB_USER }}/graphmindset:${{ env.RELEASE_TAG }}-${PLATFORM_TAG}" \ + --cache-from "type=registry,ref=${{ secrets.DOCKER_HUB_USER }}/graphmindset:cache-${PLATFORM_TAG}" \ + --cache-to "type=registry,image-manifest=true,oci-mediatypes=true,mode=max,ref=${{ secrets.DOCKER_HUB_USER }}/graphmindset:cache-${PLATFORM_TAG}" \ + --output "type=registry" ./ + + create-manifest: + runs-on: ubuntu-latest + needs: push + name: Create multi-platform manifest + steps: + - name: Check out from Git + uses: actions/checkout@v4 + - name: Set release tag + run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Create and push multi-platform manifest + run: | + docker buildx imagetools create \ + --tag "${{ secrets.DOCKER_HUB_USER }}/graphmindset:${{ env.RELEASE_TAG }}" \ + --tag "${{ secrets.DOCKER_HUB_USER }}/graphmindset:latest" \ + "${{ secrets.DOCKER_HUB_USER }}/graphmindset:${{ env.RELEASE_TAG }}-linux-amd64" \ + "${{ secrets.DOCKER_HUB_USER }}/graphmindset:${{ env.RELEASE_TAG }}-linux-arm64"