forked from sujaykundu777/devlopr-jekyll
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (66 loc) · 2.19 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Deploy Site
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
set-deploy-type:
runs-on: ubuntu-latest
outputs:
target: ${{ steps.set-output.outputs.target }}
steps:
- uses: actions/checkout@v2
- name: get deployment target
run: |
TARGET=$(cat DEPLOY_STRATEGY)
echo "TARGET=$TARGET" >> $GITHUB_ENV
- name: check if target is valid
if: success() && !contains(fromJSON('["gh-pages", "firebase", "none"]'), env.TARGET)
run: echo 'Invalid Deployment Target' && exit 1
# gh actions doesn't support using the 'env' context on job level ifs for
# some reason smh. here we use outputs instead
- name: set output to deploy target
id: set-output
run: echo "::set-output name=target::${{ env.TARGET }}"
# not sure if anyone wants this but I'm putting this here for those that don't
# want to host their site. else the actions will show an annoying x whenever
# you push to master
deploy-none:
runs-on: ubuntu-latest
needs: set-deploy-type
if: needs.set-deploy-type.outputs.target == 'none'
steps:
- run: echo 'No Deployment Specified' && exit 0
deploy-gh-pages:
runs-on: ubuntu-latest
needs: set-deploy-type
if: needs.set-deploy-type.outputs.target == 'gh-pages'
steps:
- uses: actions/checkout@v2
- name: Deploy Jekyll Site
uses: sujaykundu777/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
deploy-firebase:
runs-on: ubuntu-latest
needs: set-deploy-type
if: needs.set-deploy-type.outputs.target == 'firebase'
steps:
- uses: actions/checkout@v2
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: build jekyll
run: |
bundle install
bundle exec jekyll build
- name: deploy to firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}