Skip to content

Commit 567403f

Browse files
authored
Restore deploy action in deploy.yml file.
This file was originally created for the deploy action, but its content was replaced by an action for PR preview. This commit resolves that.
1 parent f40bbfe commit 567403f

File tree

1 file changed

+55
-44
lines changed

1 file changed

+55
-44
lines changed

.github/workflows/deploy.yml

+55-44
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,61 @@
1-
name: Deploy Preview for Pull Requests
1+
# Workflow for building and deploying a Jekyll site to GitHub Pages
2+
name: Deploy Jekyll site to Pages
23

34
on:
4-
pull_request:
5-
branches:
6-
- main
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
78

8-
jobs:
9-
build-and-deploy:
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v3
15-
16-
- name: Set up Ruby
17-
uses: ruby/setup-ruby@v1
18-
with:
19-
ruby-version: 3.1
20-
bundler-cache: true
21-
22-
- name: Install dependencies
23-
run: |
24-
bundle install
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
2511

26-
- name: Build Jekyll site
27-
run: |
28-
bundle exec jekyll build --destination _site
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
2917

30-
- name: Copy site to PR-specific folder
31-
run: |
32-
mkdir pr_preview
33-
mv _site pr_preview/${{ github.event.pull_request.number }}
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
3423

35-
- name: Deploy to GitHub Pages for preview
36-
uses: peaceiris/actions-gh-pages@v3
37-
with:
38-
personal_token: ${{ secrets.PR_PREVIEW_TOKEN }}
39-
publish_branch: gh-pages
40-
publish_dir: ./pr_preview
41-
external_repository: open-life-science/ols-site-preview
42-
cname: ''
43-
44-
- name: Comment with preview URL
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.PR_PREVIEW_TOKEN }}
47-
run: |
48-
PREVIEW_URL="http://we-are-ols.org/ols-site-preview/${{ github.event.pull_request.number }}"
49-
COMMENT_BODY="🎉 A preview of this PR is available at: [${PREVIEW_URL}](${PREVIEW_URL})"
50-
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT_BODY"
24+
jobs:
25+
# Build job
26+
build:
27+
runs-on: ubuntu-22.04
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
- name: Setup Ruby
32+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
33+
with:
34+
ruby-version: '3.1' # Not needed with a .ruby-version file
35+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
36+
cache-version: 0 # Increment this number if you need to re-download cached gems
37+
- name: Setup Pages
38+
id: pages
39+
uses: actions/configure-pages@v3
40+
- name: Build with Jekyll
41+
# Outputs to the './_site' directory by default
42+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
43+
env:
44+
JEKYLL_ENV: production
45+
- name: Upload artifact
46+
# Automatically uploads an artifact from the './_site' directory by default
47+
uses: actions/upload-pages-artifact@v3
48+
49+
50+
# Deployment job
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4
61+

0 commit comments

Comments
 (0)