diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 89940e91..9b4c9acb 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -5,7 +5,7 @@ inputs: install-command: description: Command used to install dependencies. required: false - default: pnpm install --frozen-lockfile --ignore-scripts + default: pnpm install --frozen-lockfile build: description: Whether to build the app after installing dependencies. required: false diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 5f9dadf3..f977ee2f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -5,6 +5,10 @@ on: branches: [dev] tags: - 'sable/v*' + pull_request: + paths: + - 'Dockerfile' + - '.github/workflows/docker-publish.yml' env: REGISTRY: ghcr.io @@ -27,6 +31,7 @@ jobs: persist-credentials: false - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: registry: ${{ env.REGISTRY }} @@ -68,8 +73,6 @@ jobs: - name: Setup app uses: ./.github/actions/setup - with: - install-command: pnpm install --frozen-lockfile --ignore-scripts - name: Build site env: @@ -89,7 +92,7 @@ jobs: uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . - push: true + push: ${{ github.event_name != 'pull_request' }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -99,6 +102,7 @@ jobs: site-dist=./dist - name: Generate artifact attestation + if: github.event_name != 'pull_request' uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} diff --git a/Dockerfile b/Dockerfile index 334be640..7376067c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM --platform=$BUILDPLATFORM node:24.13.1-alpine AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable +RUN apk add --no-cache git ## Builder FROM base AS builder @@ -13,10 +14,10 @@ ARG VITE_BUILD_HASH ARG VITE_IS_RELEASE_TAG=false ENV VITE_BUILD_HASH=$VITE_BUILD_HASH ENV VITE_IS_RELEASE_TAG=$VITE_IS_RELEASE_TAG -COPY pnpm-lock.yaml /src/ +COPY pnpm-lock.yaml pnpm-workspace.yaml /src/ RUN pnpm fetch COPY . /src/ -RUN pnpm install --offline --frozen-lockfile --ignore-scripts +RUN pnpm install --offline --frozen-lockfile ENV NODE_OPTIONS=--max_old_space_size=4096 RUN pnpm run build diff --git a/scripts/install-knope.js b/scripts/install-knope.js index 5557c42c..cbda39e5 100644 --- a/scripts/install-knope.js +++ b/scripts/install-knope.js @@ -115,6 +115,11 @@ function isPathWithin(candidatePath, rootPath) { const logger = new PrefixedLogger('[postinstall:knope]'); const { dim, red, green } = createTextHelpers({ useColor: logger.useColor }); +if (process.env.GITHUB_ACTIONS && process.env.CI) { + logger.info(`${dim('Running in CI environment, skipping knope installation')}`); + process.exit(0); +} + const target = TARGETS[`${process.platform}-${process.arch}`]; if (!target) { const supported = Object.keys(TARGETS).join(', '); diff --git a/vite.config.ts b/vite.config.ts index 591d2f93..4f38d92a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -93,14 +93,14 @@ const copyFiles = { const require = createRequire(import.meta.url); function serverMatrixSdkCryptoWasm() { - const resolvedPath = path.join( - path.dirname(require.resolve('@matrix-org/matrix-sdk-crypto-wasm')), - 'pkg/matrix_sdk_crypto_wasm_bg.wasm' - ); - return { name: 'vite-plugin-serve-matrix-sdk-crypto-wasm', configureServer(server: ViteDevServer) { + const resolvedPath = path.join( + path.dirname(require.resolve('@matrix-org/matrix-sdk-crypto-wasm')), + 'pkg/matrix_sdk_crypto_wasm_bg.wasm' + ); + server.middlewares.use((req, res, next) => { if (!req.url?.endsWith('matrix_sdk_crypto_wasm_bg.wasm')) { next();