Skip to content

Commit 812acb3

Browse files
Dale KunceDale Kunce
authored andcommitted
fix: Update deployment workflow to push built files to master branch
- Changed from GitHub Pages API deployment to git push to master - This maintains compatibility with existing GitHub Pages configuration - Workflow now builds site on publish branch and pushes static files to master - Simulates the original Travis CI deployment behavior
1 parent de353c4 commit 812acb3

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

.github/workflows/deploy.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ on:
77
branches: [ master, publish ]
88

99
permissions:
10-
contents: read
11-
pages: write
12-
id-token: write
13-
14-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16-
concurrency:
17-
group: "pages"
18-
cancel-in-progress: false
10+
contents: write
1911

2012
jobs:
2113
# Build job
@@ -57,29 +49,43 @@ jobs:
5749
path: _site/
5850
retention-days: 1
5951

60-
# Deployment job for GitHub Pages
52+
# Deployment job - push built files to master branch
6153
deploy:
62-
environment:
63-
name: github-pages
64-
url: ${{ steps.deployment.outputs.page_url }}
6554
runs-on: ubuntu-latest
6655
needs: build
6756
if: github.ref == 'refs/heads/publish' && github.event_name == 'push'
6857
steps:
58+
- name: Checkout master branch
59+
uses: actions/checkout@v4
60+
with:
61+
ref: master
62+
token: ${{ secrets.GITHUB_TOKEN }}
63+
fetch-depth: 0
64+
6965
- name: Download build artifacts
7066
uses: actions/download-artifact@v4
7167
with:
7268
name: site-build
7369
path: _site/
7470

75-
- name: Setup Pages
76-
uses: actions/configure-pages@v4
77-
78-
- name: Upload to GitHub Pages
79-
uses: actions/upload-pages-artifact@v4
80-
with:
81-
path: _site/
82-
83-
- name: Deploy to GitHub Pages
84-
id: deployment
85-
uses: actions/deploy-pages@v4
71+
- name: Deploy to master branch
72+
run: |
73+
# Configure git
74+
git config --local user.email "[email protected]"
75+
git config --local user.name "GitHub Action"
76+
77+
# Remove all files except .git
78+
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} +
79+
80+
# Copy built site files to root
81+
cp -r _site/* .
82+
rm -rf _site
83+
84+
# Add and commit changes
85+
git add -A
86+
if git diff --staged --quiet; then
87+
echo "No changes to deploy"
88+
else
89+
git commit -m "CI deploy to gh-pages from publish@${{ github.sha }}"
90+
git push origin master
91+
fi

0 commit comments

Comments
 (0)