Skip to content

Commit

Permalink
test 921
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianBurke committed Dec 17, 2024
1 parent f9769d2 commit 05fb47a
Showing 1 changed file with 33 additions and 22 deletions.
55 changes: 33 additions & 22 deletions .github/workflows/demo-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,7 @@ jobs:
- name: Install Bower
run: npm install -g bower

# Step 3A: Cache Node.js dependencies
- name: Cache dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Step 3B: Install dependencies and build demo files
# Step 3: Install dependencies and build demo files
- name: Install dependencies
run: npm install --legacy-peer-deps

Expand All @@ -58,39 +49,59 @@ jobs:
run: |
GHPAGES_PATH="${{ github.workspace }}/gh-pages"
if [ -d "$GHPAGES_PATH" ]; then
rm -rf "$GHPAGES_PATH"
rm -rf "$GHPAGES_PATH"
fi
git clone https://github.com/${{ github.repository_owner }}/GCWeb.git "$GHPAGES_PATH"
cd "$GHPAGES_PATH"
if git rev-parse --verify origin/gh-pages; then
git checkout gh-pages
git pull origin gh-pages
git checkout gh-pages
git pull origin gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
touch .nojekyll
git add .nojekyll
git commit -m "Initialize gh-pages branch"
git push --force origin gh-pages
git checkout --orphan gh-pages
git rm -rf .
touch .nojekyll
git add .nojekyll
git commit -m "Initialize gh-pages branch"
git push --force origin gh-pages
fi
# Step 5: Copy built files into the already cloned gh-pages folder
- name: Copy Built Files to gh-pages Root
run: |
GHPAGES_PATH="${{ github.workspace }}/gh-pages"
if [ -d "./~sites" ]; then
rsync -av ./~sites/ "$GHPAGES_PATH/"
rsync -av ./~sites/ "$GHPAGES_PATH/"
fi
if [ -d "./dist" ]; then
rsync -av ./dist/ "$GHPAGES_PATH/"
rsync -av ./dist/ "$GHPAGES_PATH/"
fi
# Step 6: Commit and push
# Step 6: Commit and Push to gh-pages
- name: Commit and Push to gh-pages
run: |
cd ${{ github.workspace }}/gh-pages
# Configure Git for this environment
git config user.name "GitHub Actions"
git config user.email "[email protected]"
# Ensure remote uses the GitHub token
git remote set-url origin https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/GCWeb.git
# Check out or initialize gh-pages
if git rev-parse --verify origin/gh-pages; then
git checkout gh-pages
git pull origin gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
touch .nojekyll
git add .nojekyll
git commit -m "Initialize gh-pages branch"
git push --force origin gh-pages
fi
# Stage and commit all changes to gh-pages
git add .
git commit -m "Update gh-pages with new demo files" --allow-empty
git pull --rebase origin gh-pages || true
Expand Down

0 comments on commit 05fb47a

Please sign in to comment.