forked from mlg-blog/mlg-blog.github.io
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish & Preview Workflows + MLG Navbar & Footer! (#6)
* Added navbar similar to MLG site in blog * Added Anaheim font only for navbar! * Minor styling updates * Added footer and modified a header a bit * Update default.html * Update default.html * Update default.html * Create jekyll-docker.yml * Create jekyll.yml * Delete .github/workflows/jekyll.yml * Update jekyll-docker.yml * Update jekyll-docker.yml * Update jekyll-docker.yml * Update jekyll-docker.yml * Update jekyll-docker.yml * Update Gemfile.lock * Update _config.yml * Update and rename jekyll-docker.yml to publish.yml * Create preview.yml * Update preview.yml * Update default.html * Update default.html * Update default.html * Update default.html * Update _config.yml * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update default.html * Update template.scss * Update default.html * Update default.html * Update default.html * cleaned code
- Loading branch information
1 parent
8419e6e
commit e2fccf2
Showing
7 changed files
with
339 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Jekyll PR Preview Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request_target: | ||
types: [opened, synchronize, closed] | ||
|
||
jobs: | ||
build-and-preview: | ||
if: github.event.action == 'opened' || github.event.action == 'synchronize' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.1' | ||
|
||
- name: Install dependencies | ||
run: | | ||
gem install bundler | ||
bundle install | ||
- name: Build the site | ||
run: bundle exec jekyll build --future | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: jamesives/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: _site | ||
target-folder: pr-previews/${{ github.event.pull_request.number }} | ||
clean: false | ||
commit-message: Deploy preview for PR ${{ github.event.pull_request.number }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
comment-preview-url: | ||
needs: build-and-preview | ||
if: needs.build-and-preview.result == 'success' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment Preview URL | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: | | ||
<!-- preview-url-comment --> | ||
Preview the changes: https://mlg.eng.cam.ac.uk/blog/pr-previews/${{ github.event.pull_request.number }} | ||
comment_tag: preview-url-comment | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
delete-preview-directory: | ||
if: github.event.action == 'closed' || github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout gh-pages branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
|
||
- name: Remove PR Preview Directory | ||
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
PREVIEW_DIR="pr-previews/${PR_NUMBER}" | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git pull origin gh-pages | ||
rm -rf ${PREVIEW_DIR} | ||
git add . | ||
git commit -m "Remove preview for merged PR #${PR_NUMBER}" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Jekyll Site CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: # manual trigger for testing | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.1' | ||
|
||
- name: Install dependencies | ||
run: | | ||
gem install bundler | ||
bundle install | ||
- name: Build the site | ||
run: bundle exec jekyll build --future | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: jamesives/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: _site | ||
clean: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ GEM | |
PLATFORMS | ||
arm64-darwin-21 | ||
x86_64-darwin-19 | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
jekyll (= 3.9) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,3 @@ exclude: | |
- LICENSE.txt | ||
- README.md | ||
- todo.tasks | ||
|
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
Oops, something went wrong.