diff --git a/.github/workflows/spz.yml b/.github/workflows/spz.yml index 8595b7d..edc202b 100644 --- a/.github/workflows/spz.yml +++ b/.github/workflows/spz.yml @@ -12,6 +12,9 @@ on: - '**' workflow_dispatch: +env: + SHA: ${{ github.event.pull_request.head.sha || github.sha }} + jobs: build: runs-on: ${{ matrix.os }} @@ -154,7 +157,8 @@ jobs: - name: Install Python build tools run: | - python -m pip install --upgrade pip setuptools wheel scikit-build ninja cmake + python -m pip install --no-cache-dir --upgrade pip setuptools wheel scikit-build ninja cmake + python -m pip cache purge || true - name: Prepare compiler environment for Windows if: runner.os == 'Windows' @@ -163,7 +167,7 @@ jobs: arch: x64 - name: Build wheels - uses: pypa/cibuildwheel@v3.0.1 + uses: pypa/cibuildwheel@v3.1.3 env: CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*" CIBW_ARCHS_LINUX: "x86_64" @@ -177,6 +181,8 @@ jobs: elif [ -f /etc/alpine-release ]; then apk update && apk add --no-cache clang lld ninja fi + pip cache purge || rm -rf ~/.cache/pip || true + CIBW_ENVIRONMENT: "PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1" CIBW_ENVIRONMENT_LINUX: "CC=clang CXX=clang++ LDFLAGS=-fuse-ld=lld" with: output-dir: dist/wheels @@ -233,3 +239,31 @@ jobs: ${{ github.workspace }}/build_wasm/index.html ${{ github.workspace }}/build_wasm/spz_wasm.js ${{ github.workspace }}/build_wasm/spz_wasm.wasm + + push-website: + needs: + - build + - build-static-linux + - build-wheels + - build-docker + - build_wasm + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: src/ts + file: src/ts/Dockerfile + platforms: linux/amd64 + push: true + tags: 404gen/spz-website:${{ env.SHA }} + no-cache: true diff --git a/src/ts/Dockerfile b/src/ts/Dockerfile new file mode 100644 index 0000000..7f91691 --- /dev/null +++ b/src/ts/Dockerfile @@ -0,0 +1,25 @@ +FROM oven/bun:1.2.19-alpine AS builder + +RUN apk update && apk upgrade --no-cache && apk add --no-cache openssl ca-certificates curl unzip && update-ca-certificates + +WORKDIR /app +COPY package.json ./ +RUN bun install + +# Copy the rest of the app +COPY . . +# Fetch latest spz-wasm.zip into public/ +RUN curl -sL https://github.com/404-Repo/spz/releases/latest/download/spz-wasm.zip -o spz-wasm.zip \ + && unzip spz-wasm.zip -d public/ \ + && rm spz-wasm.zip + +RUN bun run bun:build + +FROM oven/bun:1.2.19-alpine AS runner + +WORKDIR /app +COPY --from=builder /app . + +EXPOSE 3000 + +CMD ["bun", "run", "bun:start"] \ No newline at end of file diff --git a/src/ts/docker-compose.yml b/src/ts/docker-compose.yml new file mode 100644 index 0000000..86b0aeb --- /dev/null +++ b/src/ts/docker-compose.yml @@ -0,0 +1,7 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + ports: + - '3000:3000' \ No newline at end of file diff --git a/src/ts/package.json b/src/ts/package.json index 8541f07..3c4b383 100644 --- a/src/ts/package.json +++ b/src/ts/package.json @@ -13,17 +13,17 @@ "bun:lint": "bun --bun next lint" }, "dependencies": { - "react": "^19.1.0", - "react-dom": "^19.1.0", - "next": "^15.3.3" + "react": "^19.1.1", + "react-dom": "^19.1.1", + "next": "^15.4.5" }, "devDependencies": { - "typescript": "^5.8.3", - "@types/node": "^24.0.0", - "@types/react": "^19", - "@types/react-dom": "^19", - "eslint": "^9.28.0", - "eslint-config-next": "^15.3.3", + "typescript": "^5.9.2", + "@types/node": "^24.2.0", + "@types/react": "^19.1.9", + "@types/react-dom": "^19.1.7", + "eslint": "^9.32.0", + "eslint-config-next": "^15.4.5", "@eslint/eslintrc": "^3.3.1" } }