[Snyk] Security upgrade gatsby-transformer-remark from 5.25.1 to 6.0.0 #6773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DeployToNetlifyPreview | |
on: | |
pull_request: | |
branches: | |
- master | |
env: | |
cache-version: v2 | |
jobs: | |
check-skip-flags: | |
name: Check skip flags | |
runs-on: ubuntu-latest | |
outputs: | |
head-commit-message: ${{ steps.get-head-commit-message.outputs.headCommitMsg }} | |
steps: | |
- name: Get repo | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Print head git commit message | |
id: get-head-commit-message | |
run: | | |
echo "headCommitMsg=$(git show -s --format=%s)" >> "${GITHUB_OUTPUT}" | |
create-cache: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: yarn install | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn install --frozen-lockfile | |
# create-cache-e2e: | |
# runs-on: ubuntu-latest | |
# container: cypress/browsers:node18.12.1-chrome107-ff106-edge | |
# steps: | |
# - name: Checkout source code | |
# uses: actions/checkout@v3 | |
# - name: Setup Node | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: 18.12.1 | |
# - name: Get yarn cache directory path | |
# id: yarn-cache-dir-path | |
# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
# - name: Cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.cache | |
# ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# node_modules | |
# key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
# ${{ runner.os }}-build-${{ env.cache-version }}- | |
# - name: yarn install | |
# env: | |
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# run: yarn install --frozen-lockfile | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@tubone24' | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: 'v1.x' | |
- name: install noto font | |
run: | | |
sudo apt-get update | |
sudo apt-get install fonts-noto | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: yarn install | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn install --frozen-lockfile | |
- name: Test | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
run: yarn test:cov | |
- name: Use Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ./coverage/lcov.info | |
flag-name: Unit | |
- name: Test e2e | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
run: yarn test:e2e:ci | |
# - name: Use Coveralls | |
# uses: coverallsapp/github-action@master | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# path-to-lcov: ./coverage-e2e/lcov.info | |
# flag-name: e2e | |
- name: Test Storybook Snapshot | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
run: yarn test:storybook | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: main.spec.ts.mp4 | |
path: ./cypress/videos/main.cy.ts.mp4 | |
- name: Get PR Number | |
id: get-pr-num | |
run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}" | |
- name: Add file | |
env: | |
FILE_PATH: ./cypress/videos/main.cy.ts.mp4 | |
FILE_NAME: video-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HEAD_REF: ${{ github.head_ref }} | |
GITHUB_REPOSITORY: "tubone24/blog" | |
GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} | |
BRANCH_NAME: "screenshot" | |
run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts | |
# test-e2e-chrome: | |
# runs-on: ubuntu-latest | |
# container: cypress/browsers:node18.12.1-chrome107-ff106-edge | |
# steps: | |
# - name: Checkout source code | |
# uses: actions/checkout@v3 | |
# - name: install apt | |
# run: | | |
# apt-get -y update | |
# apt-get -y install fonts-noto unzip build-essential | |
# - uses: denoland/setup-deno@v1 | |
# with: | |
# deno-version: 'v1.x' | |
# - name: Get yarn cache directory path | |
# id: yarn-cache-dir-path | |
# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
# - name: Cache | |
# uses: actions/cache/restore@v3 | |
# with: | |
# path: | | |
# ~/.cache | |
# ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# node_modules | |
# key: ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}- | |
# - name: yarn install | |
# env: | |
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# run: yarn install --frozen-lockfile | |
# - name: chmod | |
# run: | | |
# chmod 777 -R /github/home/ | |
# chmod 777 -R src/ | |
# chmod 777 -R /__w/blog/blog/ | |
# chmod 777 -R /root/ | |
# - name: Test e2e | |
# env: | |
# GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
# GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
# GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
# GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
# GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
# GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
# GATSBY_GITHUB_SHA: ${{ github.sha }} | |
# FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
# NETLIFY_ENV: deploy-preview | |
# run: yarn test:e2e:ci:chrome | |
# - name: Get PR Number | |
# id: get-pr-num | |
# run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}" | |
# - name: Add file | |
# env: | |
# FILE_PATH: ./cypress/videos/main.cy.ts.mp4 | |
# FILE_NAME: video-chrome-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4 | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# HEAD_REF: ${{ github.head_ref }} | |
# GITHUB_REPOSITORY: "tubone24/blog" | |
# GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} | |
# BRANCH_NAME: "screenshot" | |
# run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts | |
# test-e2e-firefox: | |
# runs-on: ubuntu-latest | |
# container: cypress/browsers:node18.12.1-chrome107-ff106-edge | |
# steps: | |
# - name: Checkout source code | |
# uses: actions/checkout@v3 | |
# - name: install apt | |
# run: | | |
# apt-get -y update | |
# apt-get -y install fonts-noto unzip build-essential | |
# - uses: denoland/setup-deno@v1 | |
# with: | |
# deno-version: 'v1.x' | |
# - name: Get yarn cache directory path | |
# id: yarn-cache-dir-path | |
# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
# - name: Cache | |
# uses: actions/cache/restore@v3 | |
# with: | |
# path: | | |
# ~/.cache | |
# ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# node_modules | |
# key: ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}- | |
# - name: yarn install | |
# env: | |
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# run: yarn install --frozen-lockfile | |
# - name: chmod | |
# run: | | |
# chmod 777 -R /github/home/ | |
# chmod 777 -R src/ | |
# chmod 777 -R /__w/blog/blog/ | |
# chmod 777 -R /root/ | |
# - name: Test e2e | |
# env: | |
# GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
# GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
# GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
# GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
# GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
# GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
# GATSBY_GITHUB_SHA: ${{ github.sha }} | |
# FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
# NETLIFY_ENV: deploy-preview | |
# run: yarn test:e2e:ci:firefox | |
# - name: Get PR Number | |
# id: get-pr-num | |
# run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}" | |
# - name: Add file | |
# env: | |
# FILE_PATH: ./cypress/videos/main.cy.ts.mp4 | |
# FILE_NAME: video-firefox-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4 | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# HEAD_REF: ${{ github.head_ref }} | |
# GITHUB_REPOSITORY: "tubone24/blog" | |
# GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} | |
# BRANCH_NAME: "screenshot" | |
# run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@tubone24' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: yarn install | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn install --frozen-lockfile | |
- name: Type check | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn typecheck | |
- name: Code Lint Check | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn format | |
- name: Style Lint Check | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn format-style | |
- name: Yaml Lint Check | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn format-yml | |
build: | |
runs-on: ubuntu-latest | |
needs: check-skip-flags | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- uses: chrnorm/deployment-action@v2 | |
name: Create GitHub deployment | |
id: deployment-dev | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: development | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@tubone24' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: yarn install | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn install --frozen-lockfile | |
- name: yarn build | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
run: yarn build | |
- name: Deploy to netlify | |
run: npx netlify-cli deploy --dir=./public --functions=./functions/src > cli.txt | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
- name: Create Netlify Draft URL Message | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
run: | | |
cat cli.txt | |
sed -i '1s/^/## Deploy Preview\\n/g' cli.txt | |
sed -i -z 's/\n/\\n/g' cli.txt | |
sed -i -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" cli.txt | |
- name: Post Netlify CLI Comment | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.comments_url }} | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
-d "{\"body\": \"$(cat cli.txt)\"}" \ | |
"${URL}" | |
- name: get Netlify Draft URL | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
id: get-netlify-draft-url | |
run: | | |
echo "draftUrl=$(cat cli.txt | sed -r 's/.*Website Draft URL: (.*)\\n\\nIf everything.*/\1/')" >> "${GITHUB_OUTPUT}" | |
- uses: chrnorm/deployment-status@v2 | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') && success() }} | |
name: Create GitHub deploy (Success) | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: development | |
environment-url: ${{ steps.get-netlify-draft-url.outputs.draftUrl }} | |
deployment-id: ${{ steps.deployment-dev.outputs.deployment_id }} | |
state: "success" | |
- uses: chrnorm/deployment-status@v2 | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') && failure() }} | |
name: Create GitHub deploy (Failure) | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: development | |
environment-url: ${{ steps.get-netlify-draft-url.outputs.draftUrl }} | |
deployment-id: ${{ steps.deployment-dev.outputs.deployment_id }} | |
state: "failure" | |
outputs: | |
draftUrl: ${{ steps.get-netlify-draft-url.outputs.draftUrl }} | |
lighthouse: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check-skip-flags | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@tubone24' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: yarn install | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: yarn install --frozen-lockfile | |
- name: run lighthouse benchmark | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
run: yarn benchmark ${{ needs.build.outputs.draftUrl }} ci | |
- name: summarize scores | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
run: | | |
touch summarize.txt | |
echo '# Lighthouse Score' >> summarize.txt | |
echo '## Desktop' >> summarize.txt | |
echo '' >> summarize.txt | |
cat benchmark/summary/desktop-*.txt | sed -z 's/\n/\\n/g' >> summarize.txt | |
echo '' >> summarize.txt | |
echo '' >> summarize.txt | |
echo '## Mobile' >> summarize.txt | |
echo '' >> summarize.txt | |
cat benchmark/summary/mobile-*.txt | sed -z 's/\n/\\n/g' >> summarize.txt | |
sed -i -z 's/\n/\\n/g' summarize.txt | |
- name: Post Lighthouse Score Comment | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.comments_url }} | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
-d "{\"body\": \"$(cat summarize.txt)\"}" \ | |
${URL} | |
memlab: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@tubone24' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: yarn install | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
yarn install --frozen-lockfile | |
npm install -g memlab | |
- name: run memlab | |
run: | | |
MEMLAB_PATH=$(which memlab) | |
URL=http://localhost:9000 | |
npx start-server-and-test build-serve:e2e http://localhost:9000 "${MEMLAB_PATH} run --scenario test/memlab/testMemleak.js --work-dir test/memlab" | |
- name: summarize | |
run: | | |
cat test/memlab/data/out/leaks.txt | |
sed -i '1s/^/## Memlab leaks report\\n\<details\>\\n\\n\`\`\`\\n/g' test/memlab/data/out/leaks.txt | |
sed -i -z 's/\n/\\n/g' test/memlab/data/out/leaks.txt | |
sed -i -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" test/memlab/data/out/leaks.txt | |
echo -n "\\n \`\`\` \\n</details>\\n " >> test/memlab/data/out/leaks.txt | |
- name: Post Memlab Report Comment | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.comments_url }} | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
-d "{\"body\": \"$(cat test/memlab/data/out/leaks.txt)\"}" \ | |
"${URL}" | |
textlint: | |
name: textlint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: reviewdog/action-setup@v1 | |
with: | |
reviewdog_version: latest | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@tubone24' | |
- uses: actions/checkout@v3 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Execute textlint for article | |
run: | | |
npx textlint -f checkstyle "src/content/*.md" >> .textlint.log | |
- name: Run reviewdog | |
if: failure() | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cat .textlint.log | reviewdog -f=checkstyle -name="textlint" -reporter="github-pr-review" | |
storybook: | |
runs-on: ubuntu-latest | |
needs: check-skip-flags | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- uses: chrnorm/deployment-action@v2 | |
name: Create GitHub deployment | |
id: deployment-dev-storybook | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: development-storybook | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}" | |
- name: Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
${{ runner.os }}-build-${{ env.cache-version }}- | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.12.1 | |
- name: install dependencies | |
run: yarn install --frozen-lockfile | |
- name: yarn build | |
env: | |
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | |
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | |
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | |
NETLIFY_ENV: deploy-preview | |
run: yarn build | |
- name: build storybook | |
run: yarn build-storybook | |
env: | |
STORYBOOK_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | |
STORYBOOK_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | |
STORYBOOK_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | |
GATSBY_GITHUB_SHA: ${{ github.sha }} | |
NETLIFY_ENV: deploy-preview | |
- name: Deploy to netlify | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
run: npx netlify-cli deploy --dir=./storybook-static > cli.txt | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_STORYBOOK_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_STORYBOOK_SITE_ID }} | |
- name: Cat cli.txt | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
run: | | |
cat cli.txt | |
sed -i '1s/^/## Storybook Preview\\n/g' cli.txt | |
sed -i -z 's/\n/\\n/g' cli.txt | |
sed -i -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" cli.txt | |
cat cli.txt | |
- name: Post Netlify CLI Comment | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.comments_url }} | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${GITHUB_TOKEN}" \ | |
-d "{\"body\": \"$(cat cli.txt)\"}" \ | |
"${URL}" | |
- name: get Netlify Draft URL | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
id: get-netlify-draft-url | |
run: | | |
echo "draftUrl=$(cat cli.txt | sed -r 's/.*Website Draft URL: (.*)\\n\\nIf everything.*/\1/')" >> "${GITHUB_OUTPUT}" | |
- uses: chrnorm/deployment-status@v2 | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') && success() }} | |
name: Create GitHub deploy (Success) | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: development-storybook | |
environment-url: ${{ steps.get-netlify-draft-url.outputs.draftUrl }} | |
deployment-id: ${{ steps.deployment-dev-storybook.outputs.deployment_id }} | |
state: "success" | |
- uses: chrnorm/deployment-status@v2 | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') && failure() }} | |
name: Create GitHub deploy (Failure) | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: development-storybook | |
environment-url: ${{ steps.get-netlify-draft-url.outputs.draftUrl }} | |
deployment-id: ${{ steps.deployment-dev-storybook.outputs.deployment_id }} | |
state: "failure" | |
bundle-analyzer-link: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check-skip-flags | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create Bundle Analyzer URL Comment | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
run: | | |
cat << EOF > comments.txt | |
## Bundle Analyzer URL | |
${{ needs.build.outputs.draftUrl }}/webpack-bundle-analyser | |
EOF | |
- name: Post comments | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: ${{ github.event.pull_request.html_url }} | |
run: | |
gh pr comment -F ./comments.txt "${URL}" | |
webscreenshot: | |
needs: | |
- build | |
- check-skip-flags | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
width: [1920, 1200, 768, 400] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: 'v1.x' | |
- name: install noto font | |
run: | | |
sudo apt-get update | |
sudo apt-get install fonts-noto | |
- name: Capture Webpage Screenshot | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
uses: swinton/[email protected] | |
with: | |
source: ${{ needs.build.outputs.draftUrl }} | |
destination: screenshot-${{ matrix.os }}-${{ matrix.width }}.png | |
width: ${{ matrix.width }} | |
delay: 10 | |
- uses: actions/download-artifact@v3 | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
with: | |
name: screenshot-${{ matrix.os }}-${{ matrix.width }} | |
- name: Get PR Number | |
id: get-pr-num | |
run: echo "prnum=$(echo $GITHUB_REF | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}" | |
- name: PR Comments | |
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | |
env: | |
FILE_PATH: screenshot-${{ matrix.os }}-${{ matrix.width }}.png | |
FILE_NAME: screenshot-${{ matrix.os }}-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-${{ matrix.width }}.png | |
HEAD_REF: ${{ github.head_ref }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: "tubone24/blog" | |
GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }} | |
BRANCH_NAME: "screenshot" | |
run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts | |