1
1
name : Build and Publish Docker Container and Pypanda Docs # Only for main panda-re repo, not forks
2
2
3
3
on :
4
+ workflow_dispatch :
4
5
push :
5
6
branches :
6
7
- dev
11
12
12
13
jobs :
13
14
create_release :
14
- if : github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
15
+ name : Create next release version
16
+ if : github.repository == 'panda-re/panda'
15
17
runs-on : panda-arc
16
18
outputs :
17
19
v-version : ${{ steps.version.outputs.v-version }}
18
20
steps :
19
21
- name : Install git
20
- run : sudo apt-get -qq update -y && sudo apt-get -qq install git curl jq -y
22
+ run : |
23
+ sudo apt-get -qq update -y
24
+ sudo apt-get -qq install git curl jq -y
21
25
- name : Get next version
22
- uses : reecetech/version-increment@2023 .10.2
26
+ uses : reecetech/version-increment@2024 .10.1
23
27
id : version
24
28
with :
25
29
release_branch : dev
26
30
use_api : true
27
31
28
32
build_release_assets :
29
- if : github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
30
- needs : create_release
33
+ name : Create Panda Debian package and wheel
34
+ if : github.repository == 'panda-re/panda'
35
+ needs : [ create_release ]
31
36
runs-on : panda-arc
32
37
strategy :
33
38
matrix :
37
42
38
43
steps :
39
44
- name : Install git
40
- run : sudo apt-get -qq update -y && sudo apt-get -qq install git curl jq -y
45
+ run : |
46
+ sudo apt-get -qq update -y
47
+ sudo apt-get -qq install git curl jq -y
41
48
42
49
- name : Check out
43
50
uses : actions/checkout@v4
@@ -48,42 +55,93 @@ jobs:
48
55
working-directory : panda/debian
49
56
run : ./setup.sh Ubuntu ${{ matrix.ubuntu_version }}
50
57
51
- - name : Upload wheel and debian packages to release
52
- uses : softprops/action-gh-release@v2
53
- env :
54
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55
- with :
56
- tag_name : ${{ needs.create_release.outputs.v-version }}
57
- files : |
58
- panda/debian/pandare*.whl
59
- panda/debian/pandare*.deb
60
-
61
58
- name : Store the PyPanda distribution packages
62
59
if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
63
60
uses : actions/upload-artifact@v4
64
61
with :
65
62
name : pypanda
66
63
path : panda/debian/pandare*.whl
67
64
if-no-files-found : error
68
-
69
- - name : ' Login to Docker Registry'
70
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
65
+ retention-days : 7
66
+
67
+ - name : Store the Panda Debian packages
68
+ uses : actions/upload-artifact@v4
69
+ with :
70
+ name : panda-debian
71
+ path : panda/debian/pandare*.deb
72
+ if-no-files-found : error
73
+ retention-days : 7
74
+
75
+ publish_to_pypi_and_release :
76
+ name : Publish Python 🐍 distribution 📦 to PyPI and Create Release
77
+ if : github.repository == 'panda-re/panda'
78
+ needs : [ create_release, build_release_assets ]
79
+ runs-on : ubuntu-latest
80
+ environment :
81
+ name : pypi
82
+ url : https://pypi.org/p/pandare # Replace <package-name> with your PyPI project name
83
+ permissions :
84
+ id-token : write # IMPORTANT: mandatory for trusted publishing
85
+ contents : write # Required for creating releases
86
+ steps :
87
+ - name : Download PyPanda
88
+ uses : actions/download-artifact@v4
89
+ with :
90
+ name : pypanda
91
+ path : dist/
92
+
93
+ - name : Publish distribution 📦 to PyPI
94
+ uses : pypa/gh-action-pypi-publish@release/v1
95
+ with :
96
+ verbose : true
97
+
98
+ - name : Download Panda Debian Packages
99
+ uses : actions/download-artifact@v4
100
+ with :
101
+ name : panda-debian
102
+ path : debian/
103
+
104
+ - name : Upload wheel and debian packages to release
105
+ uses : softprops/action-gh-release@v2
106
+ env :
107
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
108
+ with :
109
+ tag_name : ${{ needs.create_release.outputs.v-version }}
110
+ files : |
111
+ dist/pandare*.whl
112
+ debian/pandare*.deb
113
+
114
+ upload_containers :
115
+ name : Build and push PANDA Docker containers
116
+ if : github.repository == 'panda-re/panda'
117
+ needs : [ create_release, publish_to_pypi_and_release ]
118
+ runs-on : panda-arc
119
+ steps :
120
+ - name : Check out
121
+ uses : actions/checkout@v4
122
+ with :
123
+ fetch-depth : 0
124
+
125
+ - name : Login to Docker Registry
71
126
uses : docker/login-action@v3
72
127
with :
73
128
username : pandare
74
129
password : ${{secrets.pandare_dockerhub}}
75
-
76
-
77
- # - name: 'Login to GHCR Registry'
78
- # if: ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
79
- # uses: docker/login-action@v3
80
- # with:
81
- # registry: ghcr.io
82
- # username: ${{ github.repository_owner }}
83
- # password: ${{ secrets.GITHUB_TOKEN }}
130
+
131
+ - name : Build pandadev:latest
132
+ uses : docker/build-push-action@v5
133
+ with :
134
+ push : true
135
+ context : ${{ github.workspace }}
136
+ tags : |
137
+ pandare/pandadev:${{ github.sha }}
138
+ pandare/pandadev:${{ needs.create_release.outputs.v-version }}
139
+ pandare/pandadev:latest
140
+ target : developer
141
+ cache-from : type=registry,ref=pandare/pandadev:cache
142
+ cache-to : type=registry,ref=pandare/pandadev:cache,mode=max
84
143
85
144
- name : Build panda:latest
86
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
87
145
uses : docker/build-push-action@v5
88
146
with :
89
147
push : true
@@ -92,119 +150,48 @@ jobs:
92
150
pandare/panda:${{ github.sha }}
93
151
pandare/panda:${{ needs.create_release.outputs.v-version }}
94
152
pandare/panda:latest
95
- # ghcr.io/pandare/panda:${{ github.sha }}
96
- # ghcr.io/pandare/panda:${{ needs.create_release.outputs.v-version }}
97
- # ghcr.io/pandare/panda:latest
98
153
target : panda
99
- - name : Build pandadev:latest
100
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
154
+ cache-from : type=registry,ref=pandare/pandadev:cache
155
+ cache-to : type=registry,ref=pandare/panda:cache,mode=max
156
+
157
+ - name : Build Panda stable container
158
+ if : github.ref_name == 'stable'
101
159
uses : docker/build-push-action@v5
102
160
with :
103
161
push : true
104
162
context : ${{ github.workspace }}
105
163
tags : |
106
- pandare/pandadev :${{ github.sha }}
107
- pandare/pandadev :${{ needs.create_release.outputs.v-version }}
108
- pandare/pandadev :latest
109
- # ghcr.io/pandare/pandadev:${{ github.sha }}
110
- # ghcr.io/ pandare/pandadev:${{ needs.create_release.outputs.v-version }}
111
- # ghcr.io/ pandare/pandadev:latest
112
- target : developer
164
+ pandare/panda_stable :${{ github.sha }}
165
+ pandare/panda_stable :${{ needs.create_release.outputs.v-version }}
166
+ pandare/panda_stable :latest
167
+ target : panda
168
+ cache-from : type=registry,ref= pandare/panda:cache
169
+ cache-to : type=registry,ref= pandare/panda_stable:cache,mode=max
170
+
113
171
- name : Checkout docs and reset
114
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
115
- run : rm -rf "${GITHUB_WORKSPACE}/auto_pydoc";
116
- 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
117
- - name : Update PYPANDA docs in container
118
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
119
- run : docker run --rm -v ${GITHUB_WORKSPACE}/auto_pydoc:/out pandare/pandadev:latest /bin/sh -c "pip3 install pdoc3==0.10.0; cd /panda/panda/python/core; pdoc3 --html --template-dir=../docs/template --force -o /out/${GITHUB_REF##*/} pandare; chmod -R 777 /out/"
120
- # will put docs in workspace/auto_pydoc/dev/pandare and/or workspace/auto_pydoc/stable/pandare
121
- # we want to copy auto_pydoc/dev/pandare to auto_pydoc/pandare/ and /auto_pydoc/stable/pandare to /auto_pydoc/pandare/stable
122
- #
123
- # This is a bit complicated, sorry. We want to keep pandare/{CNAME,.git/} and nothing else
124
- # then we copy in the new files (and merge doc-search.html and index.js with dev/pandare/
125
- - name : Push PYPANDA docs to GitHub Pages if docs changed
126
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
127
- run : cd "${GITHUB_WORKSPACE}/auto_pydoc" &&
128
- mv pandare/CNAME dev &&
129
- rm -rf pandare/* &&
130
- mv dev/pandare/* pandare &&
131
- rmdir dev/pandare &&
132
- mv dev/* pandare/ &&
133
- cd pandare &&
134
- git config --global user.email "panda-ci@panda-re.mit.edu" &&
135
- git config --global user.name "PANDA Bot" &&
136
- git add . &&
137
- git commit -m "Documentation update for PANDA commit ${{ github.sha }} branch dev" &&
138
- git push || true
172
+ run : |
173
+ rm -rf "${GITHUB_WORKSPACE}/auto_pydoc";
174
+ 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
139
175
140
- publish-to-pypi :
141
- name : Publish Python 🐍 distribution 📦 to PyPI
142
- if : github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
143
- needs :
144
- - build_release_assets
145
- runs-on : ubuntu-latest
146
- environment :
147
- name : pypi
148
- url : https://pypi.org/p/pandare # Replace <package-name> with your PyPI project name
149
- permissions :
150
- id-token : write # IMPORTANT: mandatory for trusted publishing
151
-
152
- steps :
153
- - name : Download all the dists
154
- uses : actions/download-artifact@v4
155
- with :
156
- name : pypanda
157
- path : dist/
158
-
159
- - name : Publish distribution 📦 to PyPI
160
- uses : pypa/gh-action-pypi-publish@release/v1
161
- with :
162
- verbose : true
163
-
164
- build_stable :
165
- if : github.repository == 'panda-re/panda' && github.ref == 'refs/heads/stable'
166
- runs-on : panda-arc
167
- steps :
168
- - name : Checkout PANDA at current commit
169
- uses : actions/checkout@v4
170
-
171
- - name : ' Login to Docker Registry'
172
- uses : docker/login-action@v3
173
- with :
174
- username : pandare
175
- password : ${{secrets.pandare_dockerhub}}
176
-
177
- - name : Build Bionic container
178
- # Push both dev and regular container
179
- uses : docker/build-push-action@v5
180
- with :
181
- push : true
182
- context : ${{ github.workspace }}
183
- tags : |
184
- pandare/panda_stable:${{ github.sha }}
185
- pandare/panda_stable:latest
186
- target : panda
187
-
188
- - name : Checkout docs and reset
189
- run : rm -rf "${GITHUB_WORKSPACE}/auto_pydoc";
190
- 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
191
-
192
- - name : Update PYPANDA docs in container
193
- run : docker run --rm -v ${GITHUB_WORKSPACE}/auto_pydoc/pandare:/out pandare/pandadev:latest /bin/sh -c "pip3 install pdoc3==0.10.0; cd /panda/panda/python/core; pdoc3 --html --template-dir=../docs/template --force -o /out/${GITHUB_REF##*/} pandare; chmod -R 777 /out/"
194
- # will put docs in workspace/auto_pydoc/dev/pandare and/or workspace/auto_pydoc/stable/pandare
195
- # we want to copy /auto_pydoc/dev/pandare to /auto_doc and /auto_pydoc/stable/pandare to /auto_pydoc/stable
176
+ - name : Update PYPANDA docs in container
177
+ run : docker run --rm -v ${GITHUB_WORKSPACE}/auto_pydoc/pandare:/out pandare/pandadev:latest /bin/sh -c "pip3 install pdoc3==0.10.0; cd /panda/panda/python/core; pdoc3 --html --template-dir=../docs/template --force -o /out/${GITHUB_REF##*/} pandare; chmod -R 777 /out/"
178
+
179
+ # will put docs in workspace/auto_pydoc/{dev, stable}/pandare and/or workspace/auto_pydoc/stable/pandare
180
+ # we want to copy auto_pydoc/{dev, stable}/pandare to auto_pydoc/pandare/ and /auto_pydoc/stable/pandare to /auto_pydoc/pandare/stable
196
181
#
197
- # This is a bit complicated, sorry. We create a directory stable and combine doc-search.html and index.js in there.
198
- - name : Push PYPANDA docs to GitHub Pages if docs changed
199
- # run: cd "${GITHUB_WORKSPACE}/auto_pydoc/pandare" && mv ./stable ./stable2; mv ./stable2/pandare stable; rm -rf ./stable2;
200
- run : cd "${GITHUB_WORKSPACE}/auto_pydoc" &&
201
- rm -rf pandare/stable &&
202
- mv stable/pandare/* pandare/stable &&
203
- rmdir stable/pandare &&
204
- mv stable/* pandare/stable &&
205
- cd pandare &&
206
- git config --global user.email "panda-ci@panda-re.mit.edu" &&
207
- git config --global user.name "PANDA Bot" &&
208
- git add . &&
209
- git commit -m "Documentation update for PANDA commit ${{ github.sha }} branch stable" &&
210
- git push || true
182
+ # This is a bit complicated, sorry. We want to keep pandare/{CNAME,.git/} and nothing else
183
+ # then we copy in the new files (and merge doc-search.html and index.js with {dev, stable}/pandare/
184
+ - name : Push PYPANDA docs to GitHub Pages if docs changed
185
+ run : |
186
+ cd "${GITHUB_WORKSPACE}/auto_pydoc"
187
+ mv pandare/CNAME ${{ github.ref_name }}
188
+ rm -rf pandare/*
189
+ mv ${{ github.ref_name }}/pandare/* pandare
190
+ rmdir ${{ github.ref_name }}/pandare
191
+ mv ${{ github.ref_name }}/* pandare/
192
+ cd pandare
193
+ git config --global user.email "panda-ci@panda-re.mit.edu"
194
+ git config --global user.name "PANDA Bot"
195
+ git add .
196
+ git commit -m "Documentation update for PANDA commit ${{ github.sha }} branch ${{ github.ref_name }}"
197
+ git push || true
0 commit comments