diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 4181a19..e085295 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -56,7 +56,6 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v3 with: - enablement: true # Automatically inject basePath in your Next.js configuration file and disable # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). # @@ -94,3 +93,32 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 + + post_deploy_job: + runs-on: ubuntu-latest + needs: deploy + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Execute Post-Deployment Steps + run: | + # Set up Git user config and authentication + git config user.name "JimLin94" + git config user.email "${{secrets.USER_EMAIL}}" + + - name: Commit and Push Changes + env: + GH_PAT: ${{ secrets.GH_PAT }} + run: | + # Add remote with PAT authentication + git remote add authenticated https://x-access-token:${GH_PAT}@github.com/JimLin94/jimlin94.github.io + git remote add authenticated https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git + + # Add and commit the changes + touch ${{ steps.date.outputs.date }}.txt + git add . + git commit -m "Update root level files post-deployment" + + # Push the changes to the master branch + git push authenticated HEAD:master