From 4851afe418bfd0c05ae3d8fe26f8c7da70bbfa4c Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:02:36 +0900 Subject: [PATCH 1/7] Create docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/docusaurus_deploy.yml diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml new file mode 100644 index 0000000..2fc5679 --- /dev/null +++ b/.github/workflows/docusaurus_deploy.yml @@ -0,0 +1,60 @@ +name: docusaurus_deploy + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +env: + # websiteのあるフォルダ + SOURCE_FOLDER: docs/build + +jobs: + checks: + if: github.event_name != 'push' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '14.x' + - name: Test Build + run: | + if [ -e yarn.lock ]; then + yarn install --frozen-lockfile + elif [ -e package-lock.json ]; then + npm ci + else + npm i + fi + npm run build + working-directory: ${{env.SOURCE_FOLDER}} + gh-release: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '14.x' + - uses: webfactory/ssh-agent@v0.5.0 + with: + ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} + - name: Release to GitHub Pages + env: + USE_SSH: true + GIT_USER: git + run: | + git config --global user.email "xxx@yyy" + git config --global user.name "gh-actions" + if [ -e yarn.lock ]; then + yarn install --frozen-lockfile + elif [ -e package-lock.json ]; then + npm ci + else + npm i + fi + npm run deploy + working-directory: ${{env.SOURCE_FOLDER}} From 8e584848e661feeaf0f8addd3f1d2a66908eeb09 Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:05:54 +0900 Subject: [PATCH 2/7] Update docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 42 ++++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml index 2fc5679..572ff73 100644 --- a/.github/workflows/docusaurus_deploy.yml +++ b/.github/workflows/docusaurus_deploy.yml @@ -7,10 +7,6 @@ on: pull_request: branches: [main] -env: - # websiteのあるフォルダ - SOURCE_FOLDER: docs/build - jobs: checks: if: github.event_name != 'push' @@ -19,18 +15,17 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: - node-version: '14.x' + node-version: "12.x" - name: Test Build run: | if [ -e yarn.lock ]; then - yarn install --frozen-lockfile + yarn install --frozen-lockfile elif [ -e package-lock.json ]; then - npm ci + npm ci else - npm i + npm i fi npm run build - working-directory: ${{env.SOURCE_FOLDER}} gh-release: if: github.event_name != 'pull_request' runs-on: ubuntu-latest @@ -38,23 +33,32 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: - node-version: '14.x' - - uses: webfactory/ssh-agent@v0.5.0 - with: - ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} + node-version: "12.x" + - name: Add key to allow access to repository + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + run: | + mkdir -p ~/.ssh + ssh-keyscan github.com >> ~/.ssh/known_hosts + echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + cat <> ~/.ssh/config + Host github.com + HostName github.com + IdentityFile ~/.ssh/id_rsa + EOT - name: Release to GitHub Pages env: USE_SSH: true GIT_USER: git run: | - git config --global user.email "xxx@yyy" + git config --global user.email "actions@gihub.com" git config --global user.name "gh-actions" if [ -e yarn.lock ]; then - yarn install --frozen-lockfile + yarn install --frozen-lockfile elif [ -e package-lock.json ]; then - npm ci + npm ci else - npm i + npm i fi - npm run deploy - working-directory: ${{env.SOURCE_FOLDER}} + npx docusaurus deploy From cf8f820fc2a3f040ededb01c75f808a1069397f2 Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:12:52 +0900 Subject: [PATCH 3/7] Update docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 76 ++++++++----------------- 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml index 572ff73..f255cf9 100644 --- a/.github/workflows/docusaurus_deploy.yml +++ b/.github/workflows/docusaurus_deploy.yml @@ -1,64 +1,36 @@ name: docusaurus_deploy on: - workflow_dispatch: push: branches: [main] - pull_request: - branches: [main] - + jobs: - checks: - if: github.event_name != 'push' + deploy: + name: Deploy to GitHub Pages runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 with: - node-version: "12.x" - - name: Test Build + node-version: 14.x + cache: yarn + - name: Build website + working-directory: website run: | - if [ -e yarn.lock ]; then yarn install --frozen-lockfile - elif [ -e package-lock.json ]; then - npm ci - else - npm i - fi - npm run build - gh-release: - if: github.event_name != 'pull_request' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + yarn build + + # Popular action to deploy to GitHub Pages: + # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 with: - node-version: "12.x" - - name: Add key to allow access to repository - env: - SSH_AUTH_SOCK: /tmp/ssh_agent.sock - run: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - cat <> ~/.ssh/config - Host github.com - HostName github.com - IdentityFile ~/.ssh/id_rsa - EOT - - name: Release to GitHub Pages - env: - USE_SSH: true - GIT_USER: git - run: | - git config --global user.email "actions@gihub.com" - git config --global user.name "gh-actions" - if [ -e yarn.lock ]; then - yarn install --frozen-lockfile - elif [ -e package-lock.json ]; then - npm ci - else - npm i - fi - npx docusaurus deploy + github_token: ${{ secrets.GH_PAGES_DEPLOY }} + # Build output to publish to the `gh-pages` branch: + publish_dir: ./website/build + # Assign commit authorship to the official GH-Actions bot for deploys to `gh-pages` branch: + # https://github.com/actions/checkout/issues/13#issuecomment-724415212 + # The GH actions bot is used by default if you didn't specify the two fields. + # You can swap them out with your own user credentials. + user_name: github-actions[bot] + user_email: 41898282+github-actions[bot]@users.noreply.github.com From 73abb7a67ac62dd6cff82f22aa1233e93f7412ac Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:16:00 +0900 Subject: [PATCH 4/7] Update docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml index f255cf9..b0f9e81 100644 --- a/.github/workflows/docusaurus_deploy.yml +++ b/.github/workflows/docusaurus_deploy.yml @@ -1,5 +1,4 @@ -name: docusaurus_deploy - +name: Deploy to GitHub Pages on: push: branches: [main] From 81f494c5cf4c6276beb30e4cecb428719ed95074 Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:17:14 +0900 Subject: [PATCH 5/7] Update docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml index b0f9e81..138d338 100644 --- a/.github/workflows/docusaurus_deploy.yml +++ b/.github/workflows/docusaurus_deploy.yml @@ -1,7 +1,10 @@ name: Deploy to GitHub Pages on: + workflow_dispatch: push: branches: [main] + pull_request: + branches: [main] jobs: deploy: From d3251a3f37d068fc45844a24dfceefd2e1a705ce Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:20:03 +0900 Subject: [PATCH 6/7] Update docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml index 138d338..9adfc05 100644 --- a/.github/workflows/docusaurus_deploy.yml +++ b/.github/workflows/docusaurus_deploy.yml @@ -29,7 +29,7 @@ jobs: with: github_token: ${{ secrets.GH_PAGES_DEPLOY }} # Build output to publish to the `gh-pages` branch: - publish_dir: ./website/build + publish_dir: ./build # Assign commit authorship to the official GH-Actions bot for deploys to `gh-pages` branch: # https://github.com/actions/checkout/issues/13#issuecomment-724415212 # The GH actions bot is used by default if you didn't specify the two fields. From 3050b8e3d0df0bc303fd22421cae4a5c98371878 Mon Sep 17 00:00:00 2001 From: yu5 <61819079+yukyu30@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:26:33 +0900 Subject: [PATCH 7/7] Update docusaurus_deploy.yml --- .github/workflows/docusaurus_deploy.yml | 47 ++++++++++++++----------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docusaurus_deploy.yml b/.github/workflows/docusaurus_deploy.yml index 9adfc05..dd4e6a7 100644 --- a/.github/workflows/docusaurus_deploy.yml +++ b/.github/workflows/docusaurus_deploy.yml @@ -1,14 +1,15 @@ name: Deploy to GitHub Pages + on: workflow_dispatch: - push: - branches: [main] pull_request: branches: [main] - + push: + branches: [main] + jobs: - deploy: - name: Deploy to GitHub Pages + test-deploy: + if: github.event_name != 'push' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,23 +17,27 @@ jobs: with: node-version: 14.x cache: yarn - - name: Build website - working-directory: website + - name: Test deployment run: | yarn install --frozen-lockfile yarn build - - # Popular action to deploy to GitHub Pages: - # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + deploy: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: yarn + - uses: webfactory/ssh-agent@v0.5.0 with: - github_token: ${{ secrets.GH_PAGES_DEPLOY }} - # Build output to publish to the `gh-pages` branch: - publish_dir: ./build - # Assign commit authorship to the official GH-Actions bot for deploys to `gh-pages` branch: - # https://github.com/actions/checkout/issues/13#issuecomment-724415212 - # The GH actions bot is used by default if you didn't specify the two fields. - # You can swap them out with your own user credentials. - user_name: github-actions[bot] - user_email: 41898282+github-actions[bot]@users.noreply.github.com + ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} + - name: Deploy to GitHub Pages + env: + USE_SSH: true + run: | + git config --global user.email "actions@github.com" + git config --global user.name "gh-actions" + yarn install --frozen-lockfile + yarn deploy