content_update #5
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: Update Submodule and Deploy to Vercel | |
on: | |
repository_dispatch: | |
types: [content_update] | |
jobs: | |
update_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Update submodule to latest commit | |
run: | | |
# Fetch the latest commits from the submodule | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
cd src/content | |
git fetch | |
git checkout main # Replace 'main' with the branch you want to track | |
git pull origin main # Update the submodule to the latest commit | |
cd ../.. # Return to the main repository directory | |
git add src/content | |
git commit -m "Update submodule to latest version" || echo "No changes to commit" | |
- name: Push updated submodule | |
env: | |
GITHUB_TOKEN: ${{ secrets.CONTENT_DEPLOY_TOKEN }} # Use the token from secrets | |
run: | | |
git push https://x-access-token:${GITHUB_TOKEN}@github.com/yuhangch/yuhang.ch.git HEAD:main |