-
Notifications
You must be signed in to change notification settings - Fork 18
47 lines (38 loc) · 1.31 KB
/
deploy-production-same-repo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Deploy production version of the Website on Current Repo
on:
push:
branches:
- master
schedule:
- cron: '0 0 * * *'
jobs:
Build-And-Deploy-Production:
if: ${{ github.repository_owner == 'osg-htc' }}
runs-on: ubuntu-latest
env:
CNAME: osg-htc.org
OVERRIDE_CONFIG: _config_opensciencegrid_org.yml
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Initialize GH User
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
- name: Build and Deploy
run: |
# Build the production version of website
JEKYLL_ENV=production bundle exec jekyll build --config _config.yml,${{ env.OVERRIDE_CONFIG }}
# Add in the appropriate CNAME file
echo "${{ env.CNAME }}" > _site/CNAME
# Commit the build then use 'git subtree' to create a branch with just the _site contents
git add _site -f
git commit -m "Build Production Website"
git checkout -b gh-pages `git subtree split --prefix _site master`
# Push to Production
git push --set-upstream origin gh-pages --force