OSDN Git Service

[update] : Added deploy for other repository
authorhayao <hayao@fascode.net>
Sat, 23 Oct 2021 06:38:43 +0000 (15:38 +0900)
committerhayao <hayao@fascode.net>
Sat, 23 Oct 2021 06:38:43 +0000 (15:38 +0900)
.github/workflows/hugo.yaml

index c5a01b5..0155215 100644 (file)
@@ -41,3 +41,28 @@ jobs:
           publish_branch: gh-pages
           publish_dir: ./
 
+      - name: Setup git repogitories
+        env:
+          GH_PAGES_REPO_DEPLOY_KEY: ${{ secrets.GH_PAGES_REPO_DEPLOY_KEY }}
+        run: |
+          echo "$GH_PAGES_REPO_DEPLOY_KEY" > ~/deploy_key.pem
+          chmod 600 ~/deploy_key.pem
+          git config --global user.email "hayao@fascode.net"
+          git config --global user.name "hayao"
+          ls
+          cd public
+          git config remote.origin.url "git@github.com:Hayao0819/hayao0819.github.io.git"
+          git checkout master
+
+      - name: Deploy pages
+        env:
+          GIT_SSH_COMMAND: ssh -i ~/deploy_key.pem -o StrictHostKeyChecking=no -F /dev/null
+        run: |
+          cd public
+          git add -A
+          if ! git diff --cached --quiet; then
+            git commit -m "Deploy $GITHUB_SHA by GitHub Actions"
+            git pull origin master
+            git push origin master
+          fi
+