Skip to content

Commit

Permalink
[automation] update Git Action of Next.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jim_y_lin committed Oct 18, 2023
1 parent c7031b1 commit 8733ffe
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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).
#
Expand Down Expand Up @@ -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

0 comments on commit 8733ffe

Please sign in to comment.