-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (150 loc) · 7.48 KB
/
05-deploy-github-pages.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# FILE: .github/workflows/05-deploy-github-pages.yml
#
# @see https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
# @see https://github.com/marketplace/actions/github-pages-action
name: deploy-github-pages
on:
push:
branches:
- main
jobs:
deploy-github-pages:
name: deploy-github-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download community-contributed translations via Google Sheets from HXL-CPLP
run: bash _systema/programma/download-hxl-datum.sh
# @see https://github.com/actions/setup-java#supported-distributions
- name: "Java installation (required by openapi-generator-cli) (required by Okapi Framework)"
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"
# @see https://github.com/actions/setup-node
- name: "Node/NPM installation (required by openapi-generator-cli)"
uses: actions/setup-node@v2
with:
node-version: "14"
- name: "npm install -g @openapitools/openapi-generator-cli"
run: npm install -g @openapitools/openapi-generator-cli
- name: "openapi-generator-cli: generate files"
run: bash ./_systema/programma/openapi-exportandum.sh
- name: "python: Setup Python"
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: "python: Cache pip"
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: "python: Install dependencies"
run: pip install -r requirements.txt
- name: "Okapi Framework install"
run: bash _systema/infrastructuram/okapi-install-locally.sh
continue-on-error: true
- name: "Steps before Jekyll: CNAME"
run: echo "hapi.etica.ai" > ./CNAME
# On the GitHub deploy, we explicity want it publish generated assets
- name: "Steps before Jekyll: rm .gitignore"
run: rm .gitignore
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
# - run: bundle exec rake
# 🐉 hic sunt dracones 🐉
# _[por] Explicação em português, com imagens:
# - https://github.com/HXL-CPLP/forum/issues/58#issuecomment-854233567
# [por]_
# To allow use liquid variables _even_ on data files, we
# 1. build site once, and copy data to from
# _site/data/*.l10n.json => _data/*.l10n.json
# 2. Then the real build will use the *.l10n.json, and ignore the
# source files
- name: "Steps before Jekyll: bundle exec jekyll build"
run: bundle exec jekyll build
continue-on-error: true
# TODO: _[eng-Latn] implement this fix to deal with GitHub actions 'rake aborted!
# LoadError: cannot load such file -- html-proofer
# https://github.com/gjtorikian/html-proofer/issues/326#issuecomment-753599594
# (the next lines are an potential fix for this)
# [eng-Latn]_
# @see https://github.com/gjtorikian/html-proofer#using-with-jekyll
- name: "Steps before Jekyll: bundle exec rake test (html-proofer tests)"
# run: rake test
run: bundle exec rake test
continue-on-error: true
### GitHub pages, alternative 1 __________________________________________
## If not using customizations beyond GitHub Pages default plugins,
## Use this option
# - name: Deploy to HXL-CPLP/hapi.etica.ai
# uses: peaceiris/actions-gh-pages@v3
# with:
# # github_token: ${{ secrets.GITHUB_TOKEN }}
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# user_name: "github-actions[bot]"
# user_email: "github-actions[bot]@users.noreply.github.com"
# external_repository: HXL-CPLP/hapi.etica.ai
# publish_branch: gh-pages
# publish_dir: "./"
# destination_dir: ./docs
# enable_jekyll: true
# # cname: hapi.etica.ai
### GitHub pages, alternative 2 __________________________________________
## @see https://github.com/jeffreytse/jekyll-deploy-action
## This allow use extra customizations on Jekyll
# Use GitHub Actions' cache to cache dependencies on servers
# @see https://github.com/jeffreytse/jekyll-deploy-action/issues/14#issuecomment-808108993
# @see https://github.com/nektos/act/issues/285
# Error "Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache."
# - uses: actions/cache@v2
# with:
# path: vendor/bundle
# # key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
# key: ${{ runner.os }}-gems-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/Gemfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-gems-
# Use GitHub Deploy Action to build and deploy to Github
# - uses: jeffreytse/[email protected]
# Security notice: the GH_TOKEN uses an dedicated account, @eticaaibot,
# an account to deal with public repos, instead of
# someone personal token. If you are reusing HApi code
# consider creating an GitHub account for bot-like
# actions that require access to different repository.
- uses: jeffreytse/[email protected]
with:
provider: 'github'
token: ${{ secrets.GH_TOKEN }} # It's your Personal Access Token(PAT)
repository: 'HXL-CPLP/hapi.etica.ai' # Default is current repository
branch: 'gh-pages' # Default is gh-pages for github provider
jekyll_src: './' # Default is root directory
jekyll_cfg: '_config.yml' # Default is _config.yml
# jekyll_baseurl: '' # Default is according to _config.yml
bundler_ver: '>=0' # Default is latest bundler version
cname: 'hapi.etica.ai' # Default is to not use a cname
actor: 'eticaaibot' # Default is the GITHUB_ACTOR
# TODO: create prebuild actions
# @see https://github.com/jeffreytse/jekyll-deploy-action/issues/15#issuecomment-810989660
# @see https://github.com/helaili/jekyll-action
# Another strategy to deploy github pages with even more control
# @see https://github.com/avillafiorita/jekyll-datapage_gen/issues/71#issuecomment-625532769
# @see https://github.com/JamesIves/github-pages-deploy-action
# ____________________________________________________________________________ #
#### _[por] Como executar localmente o html-proofer [por]_
## @see https://github.com/gjtorikian/html-proofer
# sudo gem install html-proofer
#
# htmlproofer --as-links https://hapi.etica.ai/
# htmlproofer --as-links https://hapi.etica.ai/,https://hapi.etica.ai/por/
#
# htmlproofer --as-links http://127.0.0.1:4000/
# htmlproofer --as-links http://127.0.0.1:4000/,http://127.0.0.1:4000/por/,http://127.0.0.1:4000/eng-Latn/api/UN/reliefweb/
### ./_site/
# htmlproofer --allow-hash-href ./_site/