-
Notifications
You must be signed in to change notification settings - Fork 480
172 lines (157 loc) · 7.41 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
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
name: Build and Publish Docker Container and Pypanda Docs # Only for main panda-re repo, not forks
on:
push:
branches:
- dev
- stable
jobs:
create_release:
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
runs-on: panda-arc
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
v-version: ${{ steps.version.outputs.v-version }}
steps:
- name: Install git
run: sudo apt-get -qq update -y && sudo apt-get -qq install git curl jq -y
- name: Get next version
uses: reecetech/version-increment@2023.10.2
id: version
with:
release_branch: dev
use_api: true
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.v-version }}
release_name: ${{ steps.version.outputs.v-version }}
build_deb:
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
needs: create_release
runs-on: panda-arc
strategy:
matrix:
ubuntu_version:
- 20.04
- 22.04
steps:
- name: Install git
run: sudo apt-get -qq update -y && sudo apt-get -qq install git -y
- name: Check out
uses: actions/checkout@v4
- name: Build package
working-directory: panda/debian
run: ./setup.sh Ubuntu ${{ matrix.ubuntu_version }}
- name: Upload packages to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: |
panda/debian/pandare_${{ matrix.ubuntu_version }}.deb
panda/debian/pandare-*.whl
asset_name: |
pandare_${{ matrix.ubuntu_version }}.deb
pandare-$(echo "$(ls panda/debian/pandare-*.whl)" | sed 's/^.*pandare-//')
asset_content_type: |
application/vnd.debian.binary-package
application/octet-stream
build_dev:
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
runs-on: panda-arc
needs: create_release
steps:
- name: 'Login to Docker Registry'
uses: docker/login-action@v3
with:
username: pandare
password: ${{secrets.pandare_dockerhub}}
- name: Install git
run: sudo apt-get -qq update -y && sudo apt-get -qq install git curl jq -y
- name: Checkout PANDA at current commit
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build panda:latest
uses: docker/build-push-action@v5
with:
push: true
context: ${{ github.workspace }}
tags: pandare/panda:${{ github.sha }}, pandare/panda:${{ needs.create_release.outputs.v-version }}, pandare/panda:latest
target: panda
- name: Build pandadev:latest
uses: docker/build-push-action@v5
with:
push: true
context: ${{ github.workspace }}
tags: pandare/pandadev:${{ github.sha }}, pandare/pandadev:${{ needs.create_release.outputs.v-version }}, pandare/pandadev:latest
target: developer
- 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: panda-arc
steps:
- name: Checkout PANDA at current commit
uses: actions/checkout@v4
- name: 'Login to Docker Registry'
uses: docker/login-action@v3
with:
username: pandare
password: ${{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:${GITHUB_SHA};
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