diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31b5c0cb..4a15a5df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,6 +62,7 @@ jobs: preview-frontend: runs-on: ubuntu-latest + environment: 'Preview' needs: - build steps: diff --git a/.github/workflows/publish-embed.yml b/.github/workflows/publish-embed.yml index f598b8a5..28b71ae7 100644 --- a/.github/workflows/publish-embed.yml +++ b/.github/workflows/publish-embed.yml @@ -13,13 +13,27 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + + - name: Cache Node.js modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/*.yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + + - name: Set up Node 20 + uses: actions/setup-node@v4 with: - node-version: '20.x' + node-version: '20' registry-url: 'https://registry.npmjs.org' + - name: Install Yarn 4 + run: | + corepack enable + yarn set version berry + - name: Install projects dependencies - uses: bahmutov/npm-install@v1 + run: yarn install - name: Publish to NPM working-directory: packages/embed diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml index f8434ab7..18dd335c 100644 --- a/.github/workflows/sentry-release.yml +++ b/.github/workflows/sentry-release.yml @@ -1,4 +1,4 @@ -name: Release Source maps to Sentry +name: Release Sourcemaps to Sentry on: push: branches: @@ -12,16 +12,29 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Cache Node.js modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/*.yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + - name: Set up Node 20 uses: actions/setup-node@v4 with: node-version: '20' + - name: Install Yarn 4 + run: | + corepack enable + yarn set version berry + - name: Install projects dependencies - uses: bahmutov/npm-install@v1 + run: yarn install - name: Generate sourcemaps from build - run: yarn build:prod --filter=@snipcode/core + run: yarn build:prod --filter=...@snipcode/core - name: Create a Sentry release env: diff --git a/apps/core/Dockerfile b/apps/core/Dockerfile index 17c6a78c..0ffd8711 100644 --- a/apps/core/Dockerfile +++ b/apps/core/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18-buster as builder +FROM node:20-buster as builder RUN mkdir app @@ -6,6 +6,8 @@ WORKDIR /app COPY . . +RUN corepack enable && yarn set version berry + RUN yarn install RUN npx prisma generate --schema=./packages/database/prisma/schema.prisma @@ -14,7 +16,7 @@ WORKDIR /app/apps/core RUN yarn build:prod -FROM node:18-alpine as schema-builder +FROM node:20-alpine as schema-builder WORKDIR /app @@ -24,7 +26,7 @@ COPY --chown=node:node --from=builder /app/packages/database/prisma/schema.prism RUN npx prisma generate --schema=./app/prisma/schema.prisma -FROM node:18-alpine AS snipcode +FROM node:20-alpine AS snipcode ENV NODE_ENV=production