-
Notifications
You must be signed in to change notification settings - Fork 15
60 lines (54 loc) · 1.95 KB
/
deploy.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
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Build and Deploy
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install Julia
uses: julia-actions/setup-julia@v1
with:
version: 1.9
- name: Fix URLs for PR preview deployment (pull request previews)
if: github.event_name == 'pull_request'
run: |
echo "JULIA_FRANKLIN_PREPATH=juliagpu/previews/PR${{ github.event.number }}" >> $GITHUB_ENV
- name: Install dependencies
uses: julia-actions/julia-buildpkg@master
- run: julia --project -e '
using Franklin;
optimize(minify=false, prerender=false);'
- name: Set preview prepath
# if this build is a PR build and the PR is NOT from a fork
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name
run: sed -i '2 i prepath = "previews/PR'${{ github.event.number }}'"' config.md
- name: Build site
run: julia --project -e '
using Pkg; Pkg.instantiate();
using Franklin;
optimize(minify=false, prerender=false);'
- name: Deploy (preview)
# if this build is a PR build and the PR is NOT from a fork
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: __site
TARGET_FOLDER: "previews/PR${{ github.event.number }}"
- name: Deploy (master)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: __site