diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58a603b..bcdec22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,6 @@ on: push: branches: [main, 'feature.*'] pull_request: - types: [reopened] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -44,15 +43,15 @@ jobs: release: name: Deploy runs-on: ubuntu-latest - if: - github.event_name == 'push' && - github.ref == 'refs/heads/main' && - github.repository == 'sass/sass-site' + needs: [test, lint] + if: github.event_name == 'push' && + github.ref == 'refs/heads/main' && + github.repository == 'sass/sass-site' steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_TOKEN }} + - uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} - # Pushing to the production branch will trigger Netlify's release process. - - run: git push -f origin main:production + # Pushing to the production branch will trigger Netlify's release process. + - run: git push -f origin main:production diff --git a/.github/workflows/shadow-repo-build.yml b/.github/workflows/shadow-repo-build.yml new file mode 100644 index 0000000..06412cf --- /dev/null +++ b/.github/workflows/shadow-repo-build.yml @@ -0,0 +1,40 @@ +name: Shadow Repo + +on: + push: + pull_request: + types: [opened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: ubuntu-latest + if: github.event_name == 'push' + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: npm + - run: npm ci + - run: npm run build-prod + - run: tar cf site.tar _site + - uses: actions/upload-artifact@v2 + with: + name: site + path: site.tar + + diff-link: + name: Comment + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.action == 'opened' + steps: + - uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ github.event.number }} + body: | + View diff of compiled files (may take a few minutes): https://github.com/${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}/compare/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.ref }} diff --git a/.github/workflows/shadow-repo.yml b/.github/workflows/shadow-repo-update.yml similarity index 52% rename from .github/workflows/shadow-repo.yml rename to .github/workflows/shadow-repo-update.yml index 97da70d..e107d05 100644 --- a/.github/workflows/shadow-repo.yml +++ b/.github/workflows/shadow-repo-update.yml @@ -1,59 +1,67 @@ -name: Sync with shadow repo +name: Shadow Repo / Update on: - push: create: delete: - pull_request: - types: [opened] + workflow_run: + workflows: Shadow Repo + types: [completed] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true jobs: - sync-branch: - name: Create/delete shadow branch + create: + name: Create Branch runs-on: ubuntu-latest - if: github.event.ref_type == 'branch' + if: github.event.ref_type == 'branch' && github.event_name == 'create' steps: - name: Clone shadow repo uses: actions/checkout@v3 with: repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }} - token: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.SASS_SITE_TOKEN }} ref: main - name: Create branch on shadow repo - if: github.event_name == 'create' run: git push origin main:${{ github.event.ref }} - - name: Delete branch on shadow repo - if: github.event_name == 'delete' - run: git push origin --delete ${{ github.event.ref }} - push-branch: - name: Push to shadow branch + delete: + name: Delete Branch runs-on: ubuntu-latest - if: github.event_name == 'push' + if: github.event.ref_type == 'branch' && github.event_name == 'delete' steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version-file: .nvmrc - cache: npm - - run: npm ci - - run: npm run build-prod - name: Clone shadow repo uses: actions/checkout@v3 with: repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }} - token: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.SASS_SITE_TOKEN }} + ref: main + - name: Delete branch on shadow repo + run: git push origin --delete ${{ github.event.ref }} + + push: + name: Push + runs-on: ubuntu-latest + if: github.event_name == 'workflow_run' + steps: + - name: Clone shadow repo + uses: actions/checkout@v3 + with: + repository: ${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }} + token: ${{ secrets.SASS_SITE_TOKEN }} ref: ${{ github.ref_name }} path: shadow-repo + - name: Download built site + uses: dawidd6/action-download-artifact@v2.27.0 + with: + name: site + run_id: ${{ github.event.workflow_run.id }} - name: Update shadow repo files run: | - cd shadow-repo - rm -rf ./* - cp -rT ../_site . + rm -rf shadow_repo/* + tar xf site.tar + cp -rT _site shadow_repo - uses: EndBug/add-and-commit@v9 with: cwd: shadow-repo @@ -61,14 +69,3 @@ jobs: author_email: sass.bot.beep.boop@gmail.com message: Update from https://github.com/${{ github.repository }}/commit/${{ github.sha }} commit: --allow-empty - - diff-link: - name: Create comment to diff link - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.action == 'opened' - steps: - - uses: peter-evans/create-or-update-comment@v2 - with: - issue-number: ${{ github.event.number }} - body: | - View diff of compiled files (may take a few minutes): https://github.com/${{ vars.SHADOW_OWNER }}/${{ vars.SHADOW_REPO }}/compare/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.ref }} diff --git a/package-lock.json b/package-lock.json index 597d44a..d086395 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "sass-site", "version": "2.0.0", "license": "MIT", + "dependencies": { + "seedrandom": "^3.0.5" + }, "devDependencies": { "@11ty/eleventy": "^2.0.1", "@11ty/eleventy-plugin-rss": "^1.2.0", @@ -31,6 +34,7 @@ "@types/markdown-it-footnote": "^3.0.0", "@types/node": "^16", "@types/prismjs": "^1.26.0", + "@types/seedrandom": "^3.0.5", "@types/semver": "^7.5.0", "cheerio": "^1.0.0-rc.12", "codemirror": "^6.0.1", @@ -54,10 +58,10 @@ "npm-run-all": "^4.1.5", "prettier": "^2.8.8", "prismjs": "^1.29.0", - "rollup": "^3.25.1", - "sass": "^1.63.4", - "semver": "^7.5.2", - "stylelint": "^15.8.0", + "rollup": "^3.25.3", + "sass": "^1.63.6", + "semver": "^7.5.3", + "stylelint": "^15.9.0", "stylelint-config-standard-scss": "^9.0.0", "truncate-html": "^1.0.4", "ts-node": "^10.9.1", @@ -2728,9 +2732,10 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "16.18.36", - "dev": true, - "license": "MIT" + "version": "16.18.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.37.tgz", + "integrity": "sha512-ql+4dw4PlPFBP495k8JzUX/oMNRI2Ei4PrMHgj8oT4VhGlYUzF4EYr0qk2fW+XBVGIrq8Zzk13m4cvyXZuv4pA==", + "dev": true }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -2747,6 +2752,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-kopEpYpFQvQdYsZkZVwht/0THHmTFFYXDaqV/lM45eweJ8kcGVDgZHs0RVTolSq55UPZNmjhKc9r7UvLu/mQQg==", + "dev": true + }, "node_modules/@types/semver": { "version": "7.5.0", "dev": true, @@ -7656,9 +7667,10 @@ } }, "node_modules/rollup": { - "version": "3.25.1", + "version": "3.25.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.25.3.tgz", + "integrity": "sha512-ZT279hx8gszBj9uy5FfhoG4bZx8c+0A1sbqtr7Q3KNWIizpTdDEPZbV2xcbvHsnFp4MavCQYZyzApJ+virB8Yw==", "dev": true, - "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, @@ -7755,9 +7767,10 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.63.4", + "version": "1.63.6", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.63.6.tgz", + "integrity": "sha512-MJuxGMHzaOW7ipp+1KdELtqKbfAWbH7OLIdoSMnVe3EXPMTmxTmlaZDCTsgIpPCs3w99lLo9/zDKkOrJuT5byw==", "dev": true, - "license": "MIT", "dependencies": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", @@ -7782,10 +7795,16 @@ "node": ">=4" } }, + "node_modules/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" + }, "node_modules/semver": { - "version": "7.5.2", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, - "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -8116,9 +8135,10 @@ "license": "ISC" }, "node_modules/stylelint": { - "version": "15.8.0", + "version": "15.9.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-15.9.0.tgz", + "integrity": "sha512-sXtAZi64CllWr6A+8ymDWnlIaYwuAa7XRmGnJxLQXFNnLjd3Izm4HAD+loKVaZ7cpK6SLxhAUX1lwPJKGCn0mg==", "dev": true, - "license": "MIT", "dependencies": { "@csstools/css-parser-algorithms": "^2.2.0", "@csstools/css-tokenizer": "^2.1.1", @@ -10708,7 +10728,9 @@ "dev": true }, "@types/node": { - "version": "16.18.36", + "version": "16.18.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.37.tgz", + "integrity": "sha512-ql+4dw4PlPFBP495k8JzUX/oMNRI2Ei4PrMHgj8oT4VhGlYUzF4EYr0qk2fW+XBVGIrq8Zzk13m4cvyXZuv4pA==", "dev": true }, "@types/normalize-package-data": { @@ -10723,6 +10745,12 @@ "version": "1.20.2", "dev": true }, + "@types/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-kopEpYpFQvQdYsZkZVwht/0THHmTFFYXDaqV/lM45eweJ8kcGVDgZHs0RVTolSq55UPZNmjhKc9r7UvLu/mQQg==", + "dev": true + }, "@types/semver": { "version": "7.5.0", "dev": true @@ -13782,7 +13810,9 @@ } }, "rollup": { - "version": "3.25.1", + "version": "3.25.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.25.3.tgz", + "integrity": "sha512-ZT279hx8gszBj9uy5FfhoG4bZx8c+0A1sbqtr7Q3KNWIizpTdDEPZbV2xcbvHsnFp4MavCQYZyzApJ+virB8Yw==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -13832,7 +13862,9 @@ "dev": true }, "sass": { - "version": "1.63.4", + "version": "1.63.6", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.63.6.tgz", + "integrity": "sha512-MJuxGMHzaOW7ipp+1KdELtqKbfAWbH7OLIdoSMnVe3EXPMTmxTmlaZDCTsgIpPCs3w99lLo9/zDKkOrJuT5byw==", "dev": true, "requires": { "chokidar": ">=3.0.0 <4.0.0", @@ -13848,8 +13880,15 @@ "kind-of": "^6.0.0" } }, + "seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" + }, "semver": { - "version": "7.5.2", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -14063,7 +14102,9 @@ "dev": true }, "stylelint": { - "version": "15.8.0", + "version": "15.9.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-15.9.0.tgz", + "integrity": "sha512-sXtAZi64CllWr6A+8ymDWnlIaYwuAa7XRmGnJxLQXFNnLjd3Izm4HAD+loKVaZ7cpK6SLxhAUX1lwPJKGCn0mg==", "dev": true, "requires": { "@csstools/css-parser-algorithms": "^2.2.0", diff --git a/package.json b/package.json index dc3471f..6a4917d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build:sass": "sass --style=compressed ./source/assets/sass/sass.scss:./source/assets/dist/css/sass.css ./source/assets/sass/noscript.scss:./source/assets/dist/css/noscript.css", "watch:sass": "sass --watch ./source/assets/sass/sass.scss:./source/assets/dist/css/sass.css ./source/assets/sass/noscript.scss:./source/assets/dist/css/noscript.css", "build-dev:scripts": "rollup -c", - "build-prod:scripts": "BABEL_ENV=production rollup -c", + "build-prod:scripts": "NODE_ENV=production BABEL_ENV=production rollup -c", "watch:scripts": "npm run build-dev:scripts -- -w", "build:typedoc": "./tool/typedoc-build.sh", "build:11ty": "NODE_OPTIONS='-r ts-node/register' eleventy", @@ -62,6 +62,7 @@ "@types/markdown-it-footnote": "^3.0.0", "@types/node": "^16", "@types/prismjs": "^1.26.0", + "@types/seedrandom": "^3.0.5", "@types/semver": "^7.5.0", "cheerio": "^1.0.0-rc.12", "codemirror": "^6.0.1", @@ -85,14 +86,17 @@ "npm-run-all": "^4.1.5", "prettier": "^2.8.8", "prismjs": "^1.29.0", - "rollup": "^3.25.1", - "sass": "^1.63.4", - "semver": "^7.5.2", - "stylelint": "^15.8.0", + "rollup": "^3.25.3", + "sass": "^1.63.6", + "semver": "^7.5.3", + "stylelint": "^15.9.0", "stylelint-config-standard-scss": "^9.0.0", "truncate-html": "^1.0.4", "ts-node": "^10.9.1", "typescript": "^5.1.3", "typogr": "^0.6.8" + }, + "dependencies": { + "seedrandom": "^3.0.5" } } diff --git a/source/_includes/footer.liquid b/source/_includes/footer.liquid index 50e9499..8eb56f4 100644 --- a/source/_includes/footer.liquid +++ b/source/_includes/footer.liquid @@ -13,13 +13,18 @@ {% renderFile 'source/_includes/footer_nav.md' %} -
+