-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 1.92 KB
/
ci-cd.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
name: ci-cd
on:
[pull_request, push, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install dependencies 🛠
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- name: Build Jekyll for GitHub Pages 👷🏻♀️
uses: actions/[email protected]
with:
source: ./
destination: ./_site
future: true
build_revision: ${{ github.sha }}
verbose: true
token: ${{ github.token }}
- name: Upload GitHub Pages artifact 📦
uses: actions/[email protected]
get-artifact:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Download Artifact 👾
uses: actions/[email protected]
- name: Display structure of downloaded files
run: ls -R
deploy:
# Use branch name for whatever purpose
needs: [get-artifact, build]
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Get branch name
run: echo 'The branch name is' $BRANCH_NAME
- name: Deploy GitHub Pages site 🌎
id: deployment
uses: actions/[email protected]