-
Notifications
You must be signed in to change notification settings - Fork 480
95 lines (84 loc) · 5.04 KB
/
publish_docker.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
name: Build and Publish Docker Container and Pypanda Docs # Only for main panda-re repo, not forks
on:
push:
branches:
- dev
- stable
jobs:
build_dev:
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
runs-on: self-hosted
steps:
- name: Checkout PANDA at current commit
uses: actions/checkout@v2
- name: Docker login
run: docker login -u pandare -p ${{secrets.pandare_dockerhub}}
- name: Build Bionic container
# Push both dev and regular container
run: DOCKER_BUILDKIT=1 docker build --progress=plain --target=panda -t pandare/panda:${GITHUB_SHA} $GITHUB_WORKSPACE;
docker tag pandare/panda:${GITHUB_SHA} pandare/panda:latest;
docker push pandare/panda;
DOCKER_BUILDKIT=1 docker build --progress=plain --target=developer -t pandare/pandadev:${GITHUB_SHA} $GITHUB_WORKSPACE;
docker tag pandare/pandadev:${GITHUB_SHA} pandare/pandadev:latest;
docker push pandare/pandadev;
- name: Checkout docs and reset
run: rm -rf "${GITHUB_WORKSPACE}/auto_pydoc";
git clone https://panda-jenkins-ci:${{ secrets.PANDABOT_GITHUB_API }}@github.com/panda-re/panda-re.github.io.git --branch=master ${GITHUB_WORKSPACE}/auto_pydoc/pandare
- name: Update PYPANDA docs in container
run: docker run --rm -v ${GITHUB_WORKSPACE}/auto_pydoc:/out pandare/pandadev:latest /bin/sh -c "pip3 install pdoc3; cd /panda/panda/python/core; pdoc3 --html --template-dir=../docs/template --force -o /out/${GITHUB_REF##*/} pandare; chmod -R 777 /out/"
# will put docs in workspace/auto_pydoc/dev/pandare and/or workspace/auto_pydoc/stable/pandare
# we want to copy auto_pydoc/dev/pandare to auto_pydoc/pandare/ and /auto_pydoc/stable/pandare to /auto_pydoc/pandare/stable
#
# This is a bit complicated, sorry. We want to keep pandare/{CNAME,.git/} and nothing else
# then we copy in the new files (and merge doc-search.html and index.js with dev/pandare/
- name: Push PYPANDA docs to GitHub Pages if docs changed
run: cd "${GITHUB_WORKSPACE}/auto_pydoc" &&
mv pandare/CNAME dev &&
rm -rf pandare/* &&
mv dev/pandare/* pandare &&
rmdir dev/pandare &&
mv dev/* pandare/ &&
cd pandare &&
git config --global user.email "panda-ci@panda-re.mit.edu" &&
git config --global user.name "PANDA Bot" &&
git add . &&
git commit -m "Documentation update for PANDA commit ${{ github.sha }} branch dev" &&
git push || true
build_stable:
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/stable'
runs-on: self-hosted
steps:
- name: Checkout PANDA at current commit
uses: actions/checkout@v1
- name: Docker login
run: docker login -u pandare -p ${{secrets.pandare_dockerhub}}
- name: Build Bionic container
# Push both dev and regular container
run: DOCKER_BUILDKIT=1 docker build --progress=plain --target=panda -t pandare/panda_stable:${GITHUB_SHA} $GITHUB_WORKSPACE;
docker tag pandare/panda_stable:${GITHUB_SHA} pandare/panda_stable:latest
docker push pandare/panda_stable;
#DOCKER_BUILDKIT=1 docker build --progress=plain --target=developer -t pandare/pandadev:${GITHUB_SHA} $GITHUB_WORKSPACE;
#docker tag pandare/panadev:${GITHUB_SHA} pandare/pandadev:latest
#docker push pandare/pandadev;
- name: Checkout docs and reset
run: rm -rf "${GITHUB_WORKSPACE}/auto_pydoc";
git clone https://panda-jenkins-ci:${{ secrets.PANDABOT_GITHUB_API }}@github.com/panda-re/panda-re.github.io.git --branch=master ${GITHUB_WORKSPACE}/auto_pydoc/pandare
- name: Update PYPANDA docs in container
run: docker run --rm -v ${GITHUB_WORKSPACE}/auto_pydoc/pandare:/out pandare/pandadev:latest /bin/sh -c "pip3 install pdoc3; cd /panda/panda/python/core; pdoc3 --html --template-dir=../docs/template --force -o /out/${GITHUB_REF##*/} pandare; chmod -R 777 /out/"
# will put docs in workspace/auto_pydoc/dev/pandare and/or workspace/auto_pydoc/stable/pandare
# we want to copy /auto_pydoc/dev/pandare to /auto_doc and /auto_pydoc/stable/pandare to /auto_pydoc/stable
#
# This is a bit complicated, sorry. We create a directory stable and combine doc-search.html and index.js in there.
- name: Push PYPANDA docs to GitHub Pages if docs changed
#run: cd "${GITHUB_WORKSPACE}/auto_pydoc/pandare" && mv ./stable ./stable2; mv ./stable2/pandare stable; rm -rf ./stable2;
run: cd "${GITHUB_WORKSPACE}/auto_pydoc" &&
rm -rf pandare/stable &&
mv stable/pandare/* pandare/stable &&
rmdir stable/pandare &&
mv stable/* pandare/stable &&
cd pandare &&
git config --global user.email "panda-ci@panda-re.mit.edu" &&
git config --global user.name "PANDA Bot" &&
git add . &&
git commit -m "Documentation update for PANDA commit ${{ github.sha }} branch stable" &&
git push || true