Stash before committing #22
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: Deploy main branch to Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages-main" | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup Git | |
run: | | |
git config --global user.name 'Arisamiga' | |
git config --global user.email '${{ secrets.EMAIL }}' | |
- name: Checkout gh-pages branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
git clone --depth 1 --branch gh-pages https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${{ github.repository }} gh-pages | |
- name: Create demo directory | |
run: | | |
mkdir -p gh-pages/demo | |
- name: Copy contents to demo folder | |
run: | | |
rsync -av --delete ./Website/ gh-pages/demo/ | |
- name: Commit and push changes | |
run: | | |
cd gh-pages | |
git add . | |
if [ -n "$(git status --porcelain)" ]; then | |
git commit -m "Deploy main branch to demo" | |
git push origin gh-pages | |
else | |
echo "No changes to commit" | |
fi |