Jelajahi Sumber

Merge pull request #3995 from weseek/master

Release
itizawa 5 tahun lalu
induk
melakukan
0ceb726373

+ 1 - 0
.github/workflows/ci-slackbot-proxy.yml

@@ -4,6 +4,7 @@ on:
   push:
     branches-ignore:
       - release/**
+      - rc/**
       - tmp/**
     paths:
       - .github/workflows/ci-slackbot-proxy.yml

+ 4 - 7
.github/workflows/ci.yml

@@ -4,11 +4,11 @@ on:
   push:
     branches-ignore:
       - release/**
+      - rc/**
       - tmp/**
     paths:
       - .github/workflows/ci.yml
       - packages/app/**
-      - packages/app-for-hoisting/**
       - .eslint*
       - .prettier*
       - .stylelint*
@@ -198,7 +198,6 @@ jobs:
       if: steps.cache-dependencies.outputs.cache-hit != 'true'
       run: |
         npx lerna bootstrap
-        yarn lerna add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs react-images@1.0.0 react-motion --scope @growi/app --scope @growi/app-for-hoisting
     - name: Print dependencies
       run: |
         echo -n "node " && node -v
@@ -271,17 +270,15 @@ jobs:
     - name: Install dependencies
       run: |
         npx lerna bootstrap
-        yarn lerna add growi-plugin-lsx growi-plugin-pukiwiki-like-linker growi-plugin-attachment-refs --scope @growi/app --scope @growi/app-for-hoisting
-        yarn lerna add -D react-images@1.0.0 react-motion --scope @growi/app --scope @growi/app-for-hoisting
-        yarn lerna run build --scope @growi/slack
     - name: Print dependencies
       run: |
         echo -n "node " && node -v
         echo -n "npm " && npm -v
         yarn list --depth=0
-    - name: yarn build:prod:analyze
+    - name: Build
       run: |
-        yarn build:prod:analyze
+        yarn lerna run build --scope @growi/slack
+        yarn lerna run build --scope @growi/app
     - name: lerna bootstrap --production
       run: |
         npx lerna bootstrap -- --production

+ 13 - 3
.github/workflows/release-rc.yml

@@ -43,6 +43,14 @@ jobs:
     - name: Set up Docker Buildx
       uses: docker/setup-buildx-action@v1
 
+    - name: Cache Docker layers
+      uses: actions/cache@v2
+      with:
+        path: /tmp/.buildx-cache
+        key: ${{ runner.os }}-buildx-app-${{ github.sha }}
+        restore-keys: |
+          ${{ runner.os }}-buildx-app-
+
     - name: Build and push
       uses: docker/build-push-action@v2
       with:
@@ -50,9 +58,11 @@ jobs:
         file: ./docker/Dockerfile
         platforms: linux/amd64
         push: true
+        cache-from: type=local,src=/tmp/.buildx-cache
+        cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
         tags: ${{ steps.meta.outputs.tags }}
 
-    - name: Check whether workspace is clean
+    - name: Move cache
       run: |
-        STATUS=`git status --porcelain`
-        if [ -z "$STATUS" ]; then exit 0; else exit 1; fi
+        rm -rf /tmp/.buildx-cache
+        mv /tmp/.buildx-cache-new /tmp/.buildx-cache

+ 31 - 12
.github/workflows/release-slackbot-proxy.yml

@@ -13,14 +13,21 @@ jobs:
     steps:
     - uses: actions/checkout@v2
 
-    - name: Get version
+    - name: Setup semver
+      id: semver
       working-directory: ./packages/slackbot-proxy
       run: |
-        export RELEASE_VERSION=`npm run version --silent`
-        echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
+        semver=`npm run version --silent`
+        echo "::set-output name=SEMVER::$semver"
 
-    - name: Set up Docker Buildx
-      uses: docker/setup-buildx-action@v1
+    - name: Docker meta
+      id: meta
+      uses: docker/metadata-action@v3
+      with:
+        images: weseek/growi-slackbot-proxy,ghcr.io/weseek/growi-slackbot-proxy,asia.gcr.io/${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}/growi-slackbot-proxy
+        tags: |
+          type=raw,value=latest
+          type=raw,value=${{ steps.semver.outputs.SEMVER }}
 
     - name: Login to docker.io registry
       run: |
@@ -44,6 +51,17 @@ jobs:
       run: |
         gcloud auth configure-docker --quiet
 
+    - name: Set up Docker Buildx
+      uses: docker/setup-buildx-action@v1
+
+    - name: Cache Docker layers
+      uses: actions/cache@v2
+      with:
+        path: /tmp/.buildx-cache
+        key: ${{ runner.os }}-buildx-slackbot-proxy-${{ github.sha }}
+        restore-keys: |
+          ${{ runner.os }}-buildx-slackbot-proxy-
+
     - name: Build and push
       uses: docker/build-push-action@v2
       with:
@@ -51,13 +69,14 @@ jobs:
         file: ./packages/slackbot-proxy/docker/Dockerfile
         platforms: linux/amd64
         push: true
-        tags: |
-          weseek/growi-slackbot-proxy:latest
-          weseek/growi-slackbot-proxy:${{ env.RELEASE_VERSION }}
-          ghcr.io/weseek/growi-slackbot-proxy:latest
-          ghcr.io/weseek/growi-slackbot-proxy:${{ env.RELEASE_VERSION }}
-          asia.gcr.io/${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}/growi-slackbot-proxy:latest
-          asia.gcr.io/${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}/growi-slackbot-proxy:${{ env.RELEASE_VERSION }}
+        cache-from: type=local,src=/tmp/.buildx-cache
+        cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
+        tags: ${{ steps.meta.outputs.tags }}
+
+    - name: Move cache
+      run: |
+        rm -rf /tmp/.buildx-cache
+        mv /tmp/.buildx-cache-new /tmp/.buildx-cache
 
     - name: Update Docker Hub Description
       uses: peter-evans/dockerhub-description@v2

+ 15 - 0
.github/workflows/release.yml

@@ -100,6 +100,14 @@ jobs:
     - name: Set up Docker Buildx
       uses: docker/setup-buildx-action@v1
 
+    - name: Cache Docker layers
+      uses: actions/cache@v2
+      with:
+        path: /tmp/.buildx-cache
+        key: ${{ runner.os }}-buildx-app-${{ github.sha }}
+        restore-keys: |
+          ${{ runner.os }}-buildx-app-
+
     - name: Build and push
       uses: docker/build-push-action@v2
       with:
@@ -107,8 +115,15 @@ jobs:
         file: ./docker/Dockerfile
         platforms: linux/amd64
         push: true
+        cache-from: type=local,src=/tmp/.buildx-cache
+        cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
         tags: ${{ steps.meta.outputs.tags }}
 
+    - name: Move cache
+      run: |
+        rm -rf /tmp/.buildx-cache
+        mv /tmp/.buildx-cache-new /tmp/.buildx-cache
+
     - name: Update Docker Hub Description
       uses: peter-evans/dockerhub-description@v2
       with:

+ 0 - 4
package.json

@@ -37,15 +37,12 @@
     "build:dev:watch:poll": "npm run build:dev:app:watch:poll",
     "build:dev": "yarn build:dev:app",
     "build:slack": "lerna run build --scope @growi/slack",
-    "build:prod:analyze": "cross-env ANALYZE=1 npm run build:prod",
-    "build:prod": "env-cmd -f config/env.prod.js webpack --config config/webpack.prod.js --profile --bail",
     "build": "npm run build:dev:watch",
     "build:poll": "npm run build:dev:watch:poll",
     "clean:app": "rimraf -- public/js public/styles",
     "clean:report": "rimraf -- report",
     "clean": "npm-run-all -p clean:*",
     "console": "env-cmd -f config/env.dev.js node --experimental-repl-await src/server/console.js",
-    "heroku-postbuild": "sh bin/heroku/install-packages.sh && npm run build:prod",
     "lint:js:fix": "eslint \"**/*.{js,jsx}\" --fix",
     "lint:js": "eslint \"**/*.{js,jsx}\"",
     "lint:styles:fix": "stylelint --fix src/client/styles/scss/**/*.scss",
@@ -60,7 +57,6 @@
     "plugin:def": "node bin/generate-plugin-definitions-source.js",
     "prebuild:dev:watch": "npm run prebuild:dev",
     "prebuild:dev": "npm run clean:app && env-cmd -f config/env.dev.js npm run plugin:def && env-cmd -f config/env.dev.js npm run resource && yarn build:slack",
-    "prebuild:prod": "npm run clean && env-cmd -f config/env.prod.js npm run plugin:def && env-cmd -f config/env.prod.js npm run resource",
     "prelint:swagger2openapi": "npm run build:apiv3:jsdoc",
     "preserver:prod": "npm run migrate",
     "prestart": "npm run build:prod",

+ 2 - 1
packages/app/package.json

@@ -3,7 +3,8 @@
   "version": "0.9.0-RC",
   "license": "MIT",
   "scripts": {
-    "build": "cd ../../ && env-cmd -f config/env.prod.js webpack --config config/webpack.prod.js --profile --bail"
+    "build": "cd ../../ && env-cmd -f config/env.prod.js webpack --config config/webpack.prod.js --profile --bail",
+    "prebuild": "cd ../../ && yarn plugin:def && yarn resource"
   },
   "// comments for dependencies": {
     "openid-client": "Node.js 12 or higher is required for openid-client@3 and above.",

+ 1 - 0
packages/slackbot-proxy/.gitignore

@@ -0,0 +1 @@
+src/public/bootstrap

+ 8 - 5
packages/slackbot-proxy/package.json

@@ -3,16 +3,19 @@
   "version": "0.9.1-RC",
   "license": "MIT",
   "scripts": {
-    "build": "yarn tsc && tsc-alias -p tsconfig.build.json && yarn postbuild",
-    "postbuild": "yarn cp:public && yarn cp:views",
-    "cp:public": "mkdir -p ./dist/public && cp -r ./src/public ./dist",
-    "cp:views": "mkdir -p ./dist/views && cp -r ./src/views ./dist",
+    "build": "yarn tsc && tsc-alias -p tsconfig.build.json",
+    "cp:public": "cp -RT ./src/public ./dist/public",
+    "cp:views": "cp -RT ./src/views ./dist/views",
+    "cp:bootstrap": "cp -RT ./node_modules/bootstrap/dist ./dist/public/bootstrap",
+    "cp:bootstrap:dev": "cp -RT ./node_modules/bootstrap/dist ./src/public/bootstrap",
     "tsc": "tsc -p tsconfig.build.json",
     "tsc:w": "yarn tsc -w",
     "dev:ci": "yarn dev --ci",
     "dev": "cross-env NODE_ENV=development ts-node-dev -r tsconfig-paths/register -r dotenv-flow/config src/index.ts",
     "start:prod:ci": "yarn start:prod --ci",
     "start:prod": "cross-env NODE_ENV=production node -r dotenv-flow/config dist/index.js",
+    "postbuild": "yarn cp:public && yarn cp:views && yarn cp:bootstrap",
+    "predev": "yarn cp:bootstrap:dev",
     "test": "yarn test:lint && yarn test:coverage",
     "test:unit": "cross-env NODE_ENV=test jest --passWithNoTests",
     "test:coverage": "yarn test:unit",
@@ -34,7 +37,6 @@
     "@tsed/swagger": "^6.43.0",
     "@tsed/typeorm": "^6.43.0",
     "axios": "^0.21.1",
-    "bootstrap": "^5.0.2",
     "browser-bunyan": "^1.6.3",
     "bunyan": "^1.8.15",
     "compression": "^1.7.4",
@@ -57,6 +59,7 @@
     "@tsed/schema": "^6.43.0",
     "@typescript-eslint/eslint-plugin": "^4.18.0",
     "@typescript-eslint/parser": "^4.18.0",
+    "bootstrap": "^5.0.2",
     "browser-bunyan": "^1.6.3",
     "eslint-import-resolver-typescript": "^2.4.0",
     "morgan": "^1.10.0",

+ 0 - 10
packages/slackbot-proxy/src/Server.ts

@@ -103,16 +103,6 @@ const helmetOptions = isProduction ? {} : {
         root: `${rootDir}/public`,
       },
     ],
-    '/css': [
-      {
-        root: `${rootDir}/../node_modules/bootstrap/dist/css`,
-      },
-    ],
-    '/js': [
-      {
-        root: `${rootDir}/../node_modules/bootstrap/dist/js`,
-      },
-    ],
   },
 })
 export class Server {

+ 1 - 1
packages/slackbot-proxy/src/views/commons/head.ejs

@@ -5,5 +5,5 @@
   <meta name="description" content="GROWI is a wiki that can be written in Markdown and easy to share information with everyone.">
   <link rel="shortcut icon" href="/images/growi-bot.png">
   <title>GROWI Official Bot</title>
-  <link href="./css/bootstrap.min.css" rel="stylesheet" >
+  <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" >
 </html>