Skip to content

Commit f8e6044

Browse files
committed
Add GitHub Actions to build, test, and deploy on Pages
1 parent 93c2805 commit f8e6044

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

Diff for: .github/workflows/test.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Test & Deploy
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- "*"
9+
10+
jobs:
11+
# Test job is always triggered as continuous integration
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: ☑️ Checkout code
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 2
19+
20+
- name: 💎 Setup Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
bundler-cache: true
24+
25+
- name: 🔧 Build & Test
26+
run: |
27+
JEKYLL_ENV=production bundle exec jekyll build
28+
JEKYLL_ENV=production bundle exec jekyll doctor
29+
SKIP_BUILD=true bundle exec rake test
30+
31+
- name: 🔔 Notify results
32+
env:
33+
IDOBATA_GITHUB_ACTIONS: ${{ secrets.IDOBATA_GITHUB_ACTIONS }}
34+
if: always() && ( env.IDOBATA_GITHUB_ACTIONS!= null )
35+
uses: yasslab/idobata_notify@main # https://github.com/yasslab/idobata_notify
36+
with:
37+
idobata_hook_url: ${{ env.IDOBATA_GITHUB_ACTIONS }}
38+
39+
# Deploy job is triggered only pushed to main branch && CI passed
40+
deploy:
41+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
42+
needs: test
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: ☑️ Checkout code
46+
uses: actions/checkout@v2
47+
with:
48+
fetch-depth: 1
49+
50+
- name: 💎 Setup Ruby
51+
uses: ruby/setup-ruby@v1
52+
with:
53+
bundler-cache: true
54+
55+
- name: 🧪 Install gems
56+
run: |
57+
bundle config set with 'test'
58+
bundle config set path 'vendor/bundle'
59+
bundle install --jobs 4 --retry 3
60+
61+
- name: 🔧 Build
62+
run: |
63+
JEKYLL_ENV=production bundle exec jekyll build
64+
65+
- name: 🚀 Deploy to GitHub Pages
66+
if: github.ref == 'refs/heads/main' && job.status == 'success'
67+
uses: peaceiris/actions-gh-pages@v3
68+
with:
69+
personal_token: ${{ secrets.GITHUB_TOKEN }}
70+
publish_dir: ./_site

0 commit comments

Comments
 (0)