diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 65e8f2b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: circleci/node:lts - steps: - - checkout - - restore_cache: - keys: - - v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum "package.json" }} - - run: npm i - - save_cache: - paths: - - node_modules - key: v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum "package.json" }} - - run: npm run build - - store_artifacts: - path: build - destination: preview - - run: 'npx status-back -s -c circleci/preview -r nodejsjp/nodejsjp.github.com "preview build success!" "https://${CIRCLE_BUILD_NUM}-856151-gh.circle-artifacts.com/0/preview/index.html"' - deploy: - docker: - - image: circleci/node:lts - steps: - - checkout - - restore_cache: - keys: - - v{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum "package.json" }} - - run: npm i - - run: ./update.sh -workflows: - version: 2 - build-deploy: - jobs: - - build - - deploy: - requires: - - build - filters: - branches: - only: source diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..cc0cfc7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,68 @@ +name: build & deploy + +on: + push: + branches: [source] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +# Let a running deploy finish rather than cancelling it half way. +concurrency: + group: deploy + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version-file: .node-version + cache: npm + - run: npm ci + - run: npm run build + # Uploaded on pull requests too, so the built site can be downloaded + # from the run page for review. + - uses: actions/upload-artifact@v7 + with: + name: site + path: build + + # nodejs.jp is served by Netlify out of the master branch, so publishing + # means committing the build output there. This mirrors the update.sh that + # CircleCI used to run. + deploy: + needs: build + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version-file: .node-version + cache: npm + - run: npm ci + - name: Check out master as the build destination + run: | + git clone --depth 1 -b master \ + "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \ + build + - run: npm run build + - name: Commit and push + working-directory: build + run: | + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add -A + if git diff --cached --quiet; then + echo 'nothing to publish' + exit 0 + fi + git commit -m 'chore(site): automated update from github actions' + git push origin HEAD:master diff --git a/.node-version b/.node-version index ac2895c..a45fd52 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -8.1.4 +24 diff --git a/bulbofile.js b/bulbofile.js index eb2b04a..3ea7fd4 100644 --- a/bulbofile.js +++ b/bulbofile.js @@ -3,8 +3,10 @@ const asset = bulbo.asset const path = require('path') const frontMatter = require('gulp-front-matter') -const nunjucks = require('gulp-nunjucks') -const markdown = require('gulp-markdown') +// gulp-nunjucks v6 / gulp-markdown v8 are ESM. require() of ESM is supported +// on Node 22.12+ so we read the named / default exports off the namespace. +const {nunjucksCompile} = require('gulp-nunjucks') +const markdown = require('gulp-markdown').default const wrapper = require('layout-wrapper') const accumulate = require('vinyl-accumulate') const branch = require('branch-pipe') @@ -35,7 +37,7 @@ const layout = defaultLayout => wrapper.nunjucks({ asset('source/**/*.md', '!source/{events,jobs,news}/**/*') .watch('source/**/*.{md,njk}') .pipe(frontMatter({property: 'fm'})) - .pipe(nunjucks.compile(data)) + .pipe(nunjucksCompile(data)) .pipe(markdown()) .pipe(layout('default')) @@ -128,3 +130,7 @@ asset('source/pdfs/**/*.pdf') // Old site is available under http://nodejs.jp/old/ asset('./old/*.*').base('./') + +// Keep CNAME in the published output rather than relying on the copy that +// happens to sit in master +asset('./CNAME').base('./') diff --git a/package-lock.json b/package-lock.json index b0abcc5..1c03663 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,9 +20,7 @@ "vinyl-accumulate": "^1.4.1" }, "devDependencies": { - "branch-pipe": "^1.0.1", - "rimraf": "^2.5.4", - "status-back": "^1.1.0" + "branch-pipe": "^1.0.1" } }, "node_modules/@types/expect": { @@ -55,12 +53,6 @@ "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==" }, - "node_modules/action-selector": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/action-selector/-/action-selector-1.0.2.tgz", - "integrity": "sha512-OlH4OkQV5Y0TbH677m9AsO7hwCcVyywjtPG9eMYyk2l/DzqEySVm+vRrrrqbZD0fJM72hUutPYkI5FvkuE5RmQ==", - "dev": true - }, "node_modules/ansi-cyan": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", @@ -978,24 +970,6 @@ "node": ">=0.10.0" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", @@ -1129,15 +1103,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/encoding": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", - "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dev": true, - "dependencies": { - "iconv-lite": "^0.6.2" - } - }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -1309,26 +1274,6 @@ "node": ">= 0.10" } }, - "node_modules/fetch-vcr": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/fetch-vcr/-/fetch-vcr-1.1.2.tgz", - "integrity": "sha512-bFOx3+5YtViximcqhG05tqMlsyPRXNOmiToDCf6TyVUCKHYP/vGPmn0HUhGVNd1jI0KpElwz+RH3X/ZQo0Asfg==", - "dev": true, - "dependencies": { - "node-fetch": "^1.6.3", - "whatwg-fetch": "^2.0.3" - } - }, - "node_modules/fetch-vcr/node_modules/node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "dev": true, - "dependencies": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } - }, "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -1733,12 +1678,6 @@ "graceful-fs": "^4.1.2" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, "node_modules/get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -1747,26 +1686,6 @@ "node": ">=0.10.0" } }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-base": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", @@ -2194,15 +2113,6 @@ "node": ">=0.10.0" } }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/has-gulplog": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", @@ -2283,18 +2193,6 @@ "node": ">=0.10.0" } }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -3043,26 +2941,6 @@ "node": ">=0.10.0" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node.extend": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.8.tgz", @@ -3273,17 +3151,6 @@ "node": ">=0.10.0" } }, - "node_modules/octokat": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/octokat/-/octokat-0.10.0.tgz", - "integrity": "sha512-VJ21L1gMlByYMurduLYiOcI8AwlZkUV8OXRN8pMXsbkIqIVqn0tgdTfxzWM9spX4VJTTG02OgqwDTqQsOmDing==", - "dev": true, - "dependencies": { - "fetch-vcr": "^1.1.0", - "lodash": "^4.16.4", - "node-fetch": "^2.0.0" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3301,12 +3168,6 @@ "readable-stream": "^2.0.1" } }, - "node_modules/pad-end": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pad-end/-/pad-end-1.0.2.tgz", - "integrity": "sha512-pHkQejQ2oo08iXEDDFYxUK1xPe8L5fpbLSpkKk+ytimW70S8golMYFP9nAPTLXW6DTt+bF5QLcbswx5imMszHg==", - "dev": true - }, "node_modules/parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -3613,18 +3474,6 @@ "node": ">=0.12" } }, - "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3638,12 +3487,6 @@ "ret": "~0.1.10" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "node_modules/set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", @@ -3982,66 +3825,6 @@ "node": ">=0.10.0" } }, - "node_modules/status-back": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/status-back/-/status-back-1.1.1.tgz", - "integrity": "sha512-ULT3jSY2tO3FaSsq/SIun2WyaLqp3E6Cegn/14HlPNBzTfnAh/YE/8MG3Jv12YJ9nnRWKGntIBs1ucQfEbfrrQ==", - "dev": true, - "dependencies": { - "action-selector": "^1.0.1", - "chalk": "^4.0.0", - "minimisted": "^2.0.0", - "octokat": "^0.10.0", - "pad-end": "^1.0.2" - }, - "bin": { - "status": "bin/status-back.js", - "status-back": "bin/status-back.js" - } - }, - "node_modules/status-back/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/status-back/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/status-back/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/stream-shift": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", @@ -4224,12 +4007,6 @@ "node": ">=0.10.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, "node_modules/tryit": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", @@ -4485,28 +4262,6 @@ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true - }, - "node_modules/whatwg-fetch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", - "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index f838c6c..ec7f942 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,6 @@ "vinyl-accumulate": "^1.4.1" }, "devDependencies": { - "branch-pipe": "^1.0.1", - "rimraf": "^2.5.4", - "status-back": "^1.1.0" + "branch-pipe": "^1.0.1" } } diff --git a/update.sh b/update.sh deleted file mode 100755 index 7a79c80..0000000 --- a/update.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -./node_modules/.bin/rimraf build -git clone -b master https://github.com/nodejsjp/nodejsjp.github.com.git build -npm run build -cd build -git add . -git commit -m 'chore(site): automated update from circleci' -git push origin HEAD