diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..4a908160 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,24 @@ +name: Deploy + +on: + push: + branches: + - 'src' + +jobs: + gh_pages: + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: "Checkout" + uses: actions/checkout@v3 + - name: "Install Dependencies" + run: yarn + - name: Deploy with gh-pages + run: | + git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + yarn deploy -- -u "github-actions-bot " + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + diff --git a/package.json b/package.json index 7d43456d..82eeedae 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "copy-to-clipboard": "^3.3.1", - "gh-pages": "^3.0.0", + "gh-pages": "^3.2.3", "highlight.js": "^10.1.1", "html-to-react": "^1.4.3", "load-script": "^1.0.0", @@ -13,19 +13,19 @@ "pressure": "^2.1.2", "react": "^16.13.1", "react-dom": "^16.13.0", + "react-lazyload": "^3.2.0", + "react-polls": "^1.2.0", "react-scripts": "^3.4.1", "react-timeago": "^4.4.0", "typescript": "^4.0.2", - "workbox-sw": "^5.1.3", - "react-polls": "^1.2.0", - "react-lazyload": "^3.2.0" + "workbox-sw": "^5.1.3" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "echo 'skipped react-scripts test --env=jsdom'", - "predeploy": "", - "deploy": "gh-pages -b $DEPLOY_BRANCH -d build -m $(TZ=Asia/Shanghai date +\"%y%m%d%H%M%S\")", + "predeploy": "REACT_APP_BUILD_INFO=autodeploy-$(TZ=Asia/Shanghai date +\"%y%m%d_%H:%M:%S\") react-scripts build", + "deploy": "gh-pages -d build", "eject": "react-scripts eject", "lint": "eslint --fix src/*.js" }, diff --git a/yarn.lock b/yarn.lock index bd5d32c3..53aa6e26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4580,26 +4580,18 @@ file-uri-to-path@1.0.0: resolved "https://registry.npm.taobao.org/file-uri-to-path/download/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" integrity sha1-VTp7hEb/b2hDWcRF8eN6BdrMM90= -filename-reserved-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/filename-reserved-regex/download/filename-reserved-regex-1.0.0.tgz#e61cf805f0de1c984567d0386dc5df50ee5af7e4" - integrity sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q= - -filenamify-url@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/filenamify-url/download/filenamify-url-1.0.0.tgz#b32bd81319ef5863b73078bed50f46a4f7975f50" - integrity sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A= - dependencies: - filenamify "^1.0.0" - humanize-url "^1.0.0" +filename-reserved-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.npmmirror.com/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz#abf73dfab735d045440abfea2d91f389ebbfa229" + integrity sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ== -filenamify@^1.0.0: - version "1.2.1" - resolved "https://registry.npm.taobao.org/filenamify/download/filenamify-1.2.1.tgz#a9f2ffd11c503bed300015029272378f1f1365a5" - integrity sha1-qfL/0RxQO+0wABUCknI3jx8TZaU= +filenamify@^4.3.0: + version "4.3.0" + resolved "https://registry.npmmirror.com/filenamify/-/filenamify-4.3.0.tgz#62391cb58f02b09971c9d4f9d63b3cf9aba03106" + integrity sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg== dependencies: - filename-reserved-regex "^1.0.0" - strip-outer "^1.0.0" + filename-reserved-regex "^2.0.0" + strip-outer "^1.0.1" trim-repeated "^1.0.0" filesize@6.0.1: @@ -4912,15 +4904,15 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -gh-pages@^3.0.0: - version "3.1.0" - resolved "https://registry.npm.taobao.org/gh-pages/download/gh-pages-3.1.0.tgz#ec3ed0f6a6e3fc3d888758fa018f08191c96bd55" - integrity sha1-7D7Q9qbj/D2Ih1j6AY8IGRyWvVU= +gh-pages@^3.2.3: + version "3.2.3" + resolved "https://registry.npmmirror.com/gh-pages/-/gh-pages-3.2.3.tgz#897e5f15e111f42af57d21d430b83e5cdf29472c" + integrity sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg== dependencies: async "^2.6.1" commander "^2.18.0" email-addresses "^3.0.1" - filenamify-url "^1.0.0" + filenamify "^4.3.0" find-cache-dir "^3.3.1" fs-extra "^8.1.0" globby "^6.1.0" @@ -5330,14 +5322,6 @@ https-browserify@^1.0.0: resolved "https://registry.npm.taobao.org/https-browserify/download/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -humanize-url@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/humanize-url/download/humanize-url-1.0.1.tgz#f4ab99e0d288174ca4e1e50407c55fbae464efff" - integrity sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8= - dependencies: - normalize-url "^1.0.0" - strip-url-auth "^1.0.0" - iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.24.tgz?cache=0&sync_timestamp=1594184264130&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ficonv-lite%2Fdownload%2Ficonv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -7229,7 +7213,7 @@ normalize-range@^0.1.2: resolved "https://registry.npm.taobao.org/normalize-range/download/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI= -normalize-url@1.9.1, normalize-url@^1.0.0: +normalize-url@1.9.1: version "1.9.1" resolved "https://registry.npm.taobao.org/normalize-url/download/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c" integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw= @@ -9979,18 +9963,13 @@ strip-json-comments@^3.0.1: resolved "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY= -strip-outer@^1.0.0: +strip-outer@^1.0.1: version "1.0.1" - resolved "https://registry.npm.taobao.org/strip-outer/download/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631" - integrity sha1-sv0qv2YEudHmATBXGV34Nrip1jE= + resolved "https://registry.npmmirror.com/strip-outer/-/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631" + integrity sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg== dependencies: escape-string-regexp "^1.0.2" -strip-url-auth@^1.0.0: - version "1.0.1" - resolved "https://registry.npm.taobao.org/strip-url-auth/download/strip-url-auth-1.0.1.tgz#22b0fa3a41385b33be3f331551bbb837fa0cd7ae" - integrity sha1-IrD6OkE4WzO+PzMVUbu4N/oM164= - style-loader@0.23.1: version "0.23.1" resolved "https://registry.npm.taobao.org/style-loader/download/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925"