Skip to content

Commit c2a023c

Browse files
committed
Fix GitHub Pages deployment - remove conflicting workflow and fix environment protection
1 parent 2620665 commit c2a023c

2 files changed

Lines changed: 14 additions & 78 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030
env:
3131
JEKYLL_ENV: production
3232

33-
- name: Upload artifact
33+
- name: Upload artifact for main branch
34+
if: github.ref == 'refs/heads/main'
3435
uses: actions/upload-pages-artifact@v3
3536
with:
3637
path: ./_site
@@ -52,24 +53,26 @@ jobs:
5253
preview:
5354
if: github.event_name == 'pull_request'
5455
runs-on: ubuntu-latest
55-
needs: build
5656
steps:
57-
- name: Download artifact
58-
uses: actions/download-artifact@v4
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
60+
- name: Setup Ruby
61+
uses: ruby/setup-ruby@v1
5962
with:
60-
name: github-pages
61-
path: ./preview-site
63+
ruby-version: '3.1'
64+
bundler-cache: true
6265

63-
- name: Extract site
64-
run: |
65-
cd preview-site
66-
tar -xf artifact.tar
66+
- name: Build PR site
67+
run: bundle exec jekyll build
68+
env:
69+
JEKYLL_ENV: production
6770

6871
- name: Deploy PR Preview
6972
uses: peaceiris/actions-gh-pages@v3
7073
with:
7174
github_token: ${{ secrets.GITHUB_TOKEN }}
72-
publish_dir: ./preview-site
75+
publish_dir: ./_site
7376
destination_dir: pr-${{ github.event.number }}
7477

7578
- name: Comment PR
@@ -82,16 +85,3 @@ jobs:
8285
repo: context.repo.repo,
8386
body: '🚀 Preview deployed to: https://devnomadic.com/pr-${{ github.event.number }}/'
8487
})
85-
86-
# Cleanup when PR is closed
87-
cleanup:
88-
if: github.event_name == 'pull_request' && github.event.action == 'closed'
89-
runs-on: ubuntu-latest
90-
steps:
91-
- name: Cleanup preview
92-
uses: peaceiris/actions-gh-pages@v3
93-
with:
94-
github_token: ${{ secrets.GITHUB_TOKEN }}
95-
publish_dir: .
96-
destination_dir: pr-${{ github.event.number }}
97-
exclude_assets: ''

.github/workflows/github-pages.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)