-
Notifications
You must be signed in to change notification settings - Fork 2
126 lines (104 loc) · 3.43 KB
/
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
name: Deploy Website
on:
push:
branches:
- master
paths-ignore:
- ".github/**"
- ".git*"
- "README.md"
workflow_dispatch:
jobs:
prod_prep:
name: Actions creating the Archive data file (archive_data.json)
runs-on: ubuntu-latest
container:
image: docker.io/python:3.11-slim
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install pipenv
run: pip install pipenv
- uses: actions/setup-python@v3
with:
python-version: "3.11"
cache: "pipenv"
- name: installing pipenv packages
run: cd .github/repo_ci-cd/deployment/ && pipenv sync
- name: Update Archive data
run: cd .github/repo_ci-cd/deployment/ && pipenv run ./csv_to_json.py > "${GITHUB_WORKSPACE}/data/archive_data.json"
- name: uploading archive data
uses: actions/upload-artifact@v3
with:
name: archive-data
path: data/
prod:
name: Deploy to prod
runs-on: ubuntu-latest
needs: prod_prep
container:
image: registry.gitlab.com/pages/hugo/hugo_extended:0.113.0
steps:
- name: Prep env
run: |
set -ex
apk add --update --no-cache openssl git bash &&
rm -rf /var/cache/apk/*
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
- name: downloading archive data
uses: actions/download-artifact@v3
with:
name: archive-data
path: data/
- name: Deploy to Github Pages
run: bash .github/repo_ci-cd/deployment/deploy.sh
env:
GITHUBTOKEN: ${{ secrets.GITHUB_TOKEN }}
ARGZ: --gc --minify --cleanDestinationDir
GH_PAGES: gh-pages
#DEBUG: 'true'
# uses: chabad360/hugo-gh-pages@v2
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# env:
# HUGO_ARGS: --gc --minify --cleanDestinationDir
# CNAME: <domain>
- name: uploading algolia data
uses: actions/upload-artifact@v3
with:
name: algolia-data
path: /tmp/gh-pages/algolia.json
# auto_actions:
# name: Actions to update Algolia after site's been deployed
# runs-on: ubuntu-latest
# needs: prod
# # https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#using-an-environment
# environment: production
# container:
# image: docker.io/python:3.11-slim
# steps:
# - name: Checkout Code
# uses: actions/checkout@v2
# - name: Install pipenv
# run: pip install pipenv
# - uses: actions/setup-python@v3
# with:
# python-version: "3.11"
# cache: "pipenv"
# - name: installing pipenv packages
# run: cd .github/repo_ci-cd/deployment/ && pipenv sync
# - name: downloading algolia data
# uses: actions/download-artifact@v3
# with:
# name: algolia-data
# - name: Update Algolia index
# run: cd .github/repo_ci-cd/deployment/ && pipenv run ./algolia.py
# # https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow
# env:
# ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
# ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
# ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}