Skip to content

Commit 07ffad1

Browse files
committed
Refactor GitHub Actions workflow for clarity and improved deployment structure
1 parent 0b91db6 commit 07ffad1

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Deploy to GitHub Pages
22

3-
on:
3+
on:
44
push:
5-
branches:
5+
branches:
66
- main
77
- dev
88
workflow_dispatch:
@@ -13,53 +13,53 @@ permissions:
1313
id-token: write
1414

1515
concurrency:
16-
group: "pages-${{ github.ref }}"
17-
cancel-in-progress: true
16+
group: "pages"
17+
cancel-in-progress: true
1818

1919
jobs:
2020
build-and-deploy:
2121
runs-on: ubuntu-latest
22-
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v4
22+
steps:
23+
- name: Checkout main branch
24+
uses: actions/checkout@v4
25+
with:
26+
ref: main
27+
path: main-content
2528

26-
- name: Determine deployment path
27-
id: deploy-path
28-
run: |
29-
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
30-
echo "path=." >> $GITHUB_OUTPUT
31-
echo "environment=production" >> $GITHUB_OUTPUT
32-
else
33-
echo "path=dev" >> $GITHUB_OUTPUT
34-
echo "environment=development" >> $GITHUB_OUTPUT
35-
fi
29+
- name: Checkout dev branch
30+
uses: actions/checkout@v4
31+
with:
32+
ref: dev
33+
path: dev-content
3634

3735
- name: Setup Pages
3836
uses: actions/configure-pages@v4
3937

40-
- name: Prepare deployment directory
38+
- name: Prepare combined deployment
4139
run: |
42-
mkdir -p _site/${{ steps. deploy-path.outputs.path }}
43-
if [ "${{ steps. deploy-path.outputs.path }}" == "." ]; then
44-
cp -r * _site/ 2>/dev/null || true
45-
cp -r .??* _site/ 2>/dev/null || true
46-
rm -rf _site/.git _site/.github
47-
else
48-
cp -r * _site/${{ steps.deploy-path.outputs.path }}/ 2>/dev/null || true
49-
rm -rf _site/${{ steps.deploy-path.outputs.path }}/.git
50-
fi
40+
mkdir -p _site
41+
42+
# Copy main branch content to root
43+
cp -r main-content/* _site/ 2>/dev/null || true
44+
cp -r main-content/.??* _site/ 2>/dev/null || true
45+
46+
# Copy dev branch content to /dev subdirectory
47+
mkdir -p _site/dev
48+
cp -r dev-content/* _site/dev/ 2>/dev/null || true
49+
cp -r dev-content/. ??* _site/dev/ 2>/dev/null || true
50+
51+
# Clean up git directories
52+
rm -rf _site/. git _site/.github _site/dev/.git _site/dev/.github
5153
5254
- name: Upload artifact
53-
uses: actions/upload-pages-artifact@v3
55+
uses: actions/upload-pages-artifact@v3
5456

5557
- name: Deploy to GitHub Pages
5658
id: deployment
5759
uses: actions/deploy-pages@v4
5860

5961
- name: Comment deployment URL
6062
run: |
61-
if [ "${{ steps.deploy-path.outputs.environment }}" == "production" ]; then
62-
echo "✅ Production deployed to main site"
63-
else
64-
echo "✅ Development deployed to /dev subdirectory"
65-
fi
63+
echo "✅ Deployed successfully!"
64+
echo "📦 Main branch: https://mralders0n.github.io/MeshCore-GOME-WarDriver/"
65+
echo "🔧 Dev branch: https://mralders0n.github.io/MeshCore-GOME-WarDriver/dev/"

0 commit comments

Comments
 (0)