From bde7245ce14512843924f974a787a7cca91c1798 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 11 Feb 2026 08:28:40 +0100 Subject: [PATCH 1/3] chore: merge docker build workflows into one --- .github/workflows/build-docker.yml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/build-docker.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 000000000..ae1cdcf06 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,54 @@ +name: Build docker images + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + package: + - default + - cdn + - api + - gateway + - admin-api + - cdn-cs + - gateway-offload + steps: + - uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Clone the server repository + run: git clone https://github.com/spacebarchat/server + - name: Build the docker image + run: nix build .#containers.x86_64-linux.docker.${{ matrix.package }} + working-directory: server + - run: docker load < result + working-directory: server + - name: downcase REPO + run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Compute image suffix + run: | + if [ "${{ matrix.package }}" = "default" ]; then + echo "SUFFIX=" >> $GITHUB_ENV + else + echo "SUFFIX=-${{ matrix.package }}" >> $GITHUB_ENV + fi + - name: Tag and push the image + run: | + IMAGE_ID=$(docker images spacebar-server-ts$SUFFIX --format '{{.ID}}') + docker tag $IMAGE_ID ghcr.io/$REPO$SUFFIX:latest + docker push ghcr.io/$REPO$SUFFIX:latest From 3d46027476acedab80235023d7afec1af96f8a71 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 11 Feb 2026 08:31:47 +0100 Subject: [PATCH 2/3] chore: remove separated workflow files --- .github/workflows/build-docker-admin-api.yml | 36 ------------------ .github/workflows/build-docker-api.yml | 38 ------------------- .github/workflows/build-docker-bundle.yml | 36 ------------------ .github/workflows/build-docker-cdn-cs.yml | 36 ------------------ .github/workflows/build-docker-cdn.yml | 38 ------------------- .../build-docker-gateway-offload.yml | 36 ------------------ .github/workflows/build-docker-gateway.yml | 38 ------------------- 7 files changed, 258 deletions(-) delete mode 100644 .github/workflows/build-docker-admin-api.yml delete mode 100644 .github/workflows/build-docker-api.yml delete mode 100644 .github/workflows/build-docker-bundle.yml delete mode 100644 .github/workflows/build-docker-cdn-cs.yml delete mode 100644 .github/workflows/build-docker-cdn.yml delete mode 100644 .github/workflows/build-docker-gateway-offload.yml delete mode 100644 .github/workflows/build-docker-gateway.yml diff --git a/.github/workflows/build-docker-admin-api.yml b/.github/workflows/build-docker-admin-api.yml deleted file mode 100644 index 955e29cf8..000000000 --- a/.github/workflows/build-docker-admin-api.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build admin api docker image - -on: - push: - branches: - - master - paths: - - "extra/admin-api/Spacebar.AdminApi/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.admin-api - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts-admin-api --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO-admin-api - docker push ghcr.io/$REPO-admin-api diff --git a/.github/workflows/build-docker-api.yml b/.github/workflows/build-docker-api.yml deleted file mode 100644 index 9f9714193..000000000 --- a/.github/workflows/build-docker-api.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build api docker image - -on: - push: - branches: - - master - paths: - - "src/api/**" - - "src/schemas/**" - - "src/util/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.api - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts-api --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO-api - docker push ghcr.io/$REPO-api diff --git a/.github/workflows/build-docker-bundle.yml b/.github/workflows/build-docker-bundle.yml deleted file mode 100644 index b102ab4ee..000000000 --- a/.github/workflows/build-docker-bundle.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build bundle docker image - -on: - push: - branches: - - master - paths: - - "src/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.default - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO - docker push ghcr.io/$REPO diff --git a/.github/workflows/build-docker-cdn-cs.yml b/.github/workflows/build-docker-cdn-cs.yml deleted file mode 100644 index 18e2a1af9..000000000 --- a/.github/workflows/build-docker-cdn-cs.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build cdn cs docker image - -on: - push: - branches: - - master - paths: - - "extra/admin-api/Spacebar.Cdn/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.cdn-cs - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts-cdn-cs --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO-cdn-cs - docker push ghcr.io/$REPO-cdn-cs diff --git a/.github/workflows/build-docker-cdn.yml b/.github/workflows/build-docker-cdn.yml deleted file mode 100644 index c79d9a37d..000000000 --- a/.github/workflows/build-docker-cdn.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build cdn docker image - -on: - push: - branches: - - master - paths: - - "src/cdn/**" - - "src/schemas/**" - - "src/util/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.cdn - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts-cdn --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO-cdn - docker push ghcr.io/$REPO-cdn diff --git a/.github/workflows/build-docker-gateway-offload.yml b/.github/workflows/build-docker-gateway-offload.yml deleted file mode 100644 index f6c6c71e0..000000000 --- a/.github/workflows/build-docker-gateway-offload.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build gateway offload docker image - -on: - push: - branches: - - master - paths: - - "extra/admin-api/Spacebar.GatewayOffload/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.gateway-offload - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts-gateway-offload --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO-gateway-offload - docker push ghcr.io/$REPO-gateway-offload diff --git a/.github/workflows/build-docker-gateway.yml b/.github/workflows/build-docker-gateway.yml deleted file mode 100644 index fc5ac8b26..000000000 --- a/.github/workflows/build-docker-gateway.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build gateway docker image - -on: - push: - branches: - - master - paths: - - "src/gateway/**" - - "src/schemas/**" - - "src/util/**" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Build the docker image - run: nix build .#containers.x86_64-linux.docker.gateway - - run: docker load < result - - name: downcase REPO - run: echo "REPO=${GITHUB_REPOSITORY,,}" >>$GITHUB_ENV - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Tag and push the image - run: | - IMAGE_ID=$(docker images spacebar-server-ts-gateway --format '{{.ID}}') - docker tag $IMAGE_ID ghcr.io/$REPO-gateway - docker push ghcr.io/$REPO-gateway From 51e49c8481c1676b66602b1c01eba5c085af451a Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 11 Feb 2026 08:34:31 +0100 Subject: [PATCH 3/3] use checkout --- .github/workflows/build-docker.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index ae1cdcf06..e4eae70af 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -22,11 +22,10 @@ jobs: - cdn-cs - gateway-offload steps: + - uses: actions/checkout@v6 - uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable - - name: Clone the server repository - run: git clone https://github.com/spacebarchat/server - name: Build the docker image run: nix build .#containers.x86_64-linux.docker.${{ matrix.package }} working-directory: server