-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (61 loc) · 2.24 KB
/
build.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
name: Gitbook Offline Renderer
env:
GITBOOK_USER: [email protected]
DOCKERHUB_USER: gstbot
DOCKER_IMAGE_TAG: tgexternal/document:latest
on:
push:
branches: [master]
pull_request:
branches: ["*"]
schedule:
- cron: "0 0 * * *" # update every day
jobs:
build:
name: Build Docker
runs-on: ubuntu-latest
steps:
- name: Check out code into the source code repository
uses: actions/checkout@v2
- name: Install Selenium and Webdriver Manager
run: sudo python3 -m pip install -U selenium webdriver_manager
- name: Download Exported Data
run: python3 ./tools/export_gitbook.py --headless --user ${{ env.GITBOOK_USER}} --password ${{ secrets.GITBOOK_PASSWORD }} --target ./gitbook.zip
- name: Upload Gitbook exported data
uses: actions/upload-artifact@v1
with:
name: exported-gitbook-content
path: gitbook.zip
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "13.12.0"
- name: Setup YARN
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
sudo apt update && sudo apt install --no-install-recommends yarn
- name: Cache node_modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ./build_temp/source/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Cache Go Modules
uses: actions/cache@v1
env:
cache-name: cache-go-modules
with:
path: ~/go
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('go.mod') }}
- name: Build Docker Image
run: |
make docker-image
docker login -u ${{ env.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker tag document:latest ${{ env.DOCKER_IMAGE_TAG }}
- name: Push Docker Image
if: ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
run: |
docker push ${{ env.DOCKER_IMAGE_TAG }}