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
22
run : sudo apt-get -qq update -y && sudo apt-get -qq install git curl jq -y
21
23
- name : Get next version
22
- uses : reecetech/version-increment@2023 .10.2
24
+ uses : reecetech/version-increment@2024 .10.1
23
25
id : version
24
26
with :
25
27
release_branch : dev
26
28
use_api : true
27
29
28
30
build_release_assets :
29
- if : github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
30
- needs : create_release
31
+ name : Create Panda Debian package and wheel
32
+ if : github.repository == 'panda-re/panda'
33
+ needs : [ create_release ]
31
34
runs-on : panda-arc
32
35
strategy :
33
36
matrix :
@@ -48,42 +51,93 @@ jobs:
48
51
working-directory : panda/debian
49
52
run : ./setup.sh Ubuntu ${{ matrix.ubuntu_version }}
50
53
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
54
- name : Store the PyPanda distribution packages
62
55
if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
63
56
uses : actions/upload-artifact@v4
64
57
with :
65
58
name : pypanda
66
59
path : panda/debian/pandare*.whl
67
60
if-no-files-found : error
68
-
69
- - name : ' Login to Docker Registry'
70
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
61
+ retention-days : 7
62
+
63
+ - name : Store the Panda Debian packages
64
+ uses : actions/upload-artifact@v4
65
+ with :
66
+ name : panda-debian
67
+ path : panda/debian/pandare*.deb
68
+ if-no-files-found : error
69
+ retention-days : 7
70
+
71
+ publish_to_pypi_and_release :
72
+ name : Publish Python 🐍 distribution 📦 to PyPI and Create Release
73
+ if : github.repository == 'panda-re/panda'
74
+ needs : [ create_release, build_release_assets ]
75
+ runs-on : ubuntu-latest
76
+ environment :
77
+ name : pypi
78
+ url : https://pypi.org/p/pandare # Replace <package-name> with your PyPI project name
79
+ permissions :
80
+ id-token : write # IMPORTANT: mandatory for trusted publishing
81
+ contents : write # Required for creating releases
82
+ steps :
83
+ - name : Download PyPanda
84
+ uses : actions/download-artifact@v4
85
+ with :
86
+ name : pypanda
87
+ path : dist/
88
+
89
+ - name : Publish distribution 📦 to PyPI
90
+ uses : pypa/gh-action-pypi-publish@release/v1
91
+ with :
92
+ verbose : true
93
+
94
+ - name : Download Panda Debian Packages
95
+ uses : actions/download-artifact@v4
96
+ with :
97
+ name : panda-debian
98
+ path : debian/
99
+
100
+ - name : Upload wheel and debian packages to release
101
+ uses : softprops/action-gh-release@v2
102
+ env :
103
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104
+ with :
105
+ tag_name : ${{ needs.create_release.outputs.v-version }}
106
+ files : |
107
+ dist/pandare*.whl
108
+ debian/pandare*.deb
109
+
110
+ upload_containers :
111
+ name : Build and push PANDA Docker containers
112
+ if : github.repository == 'panda-re/panda'
113
+ needs : [ create_release, publish_to_pypi_and_release ]
114
+ runs-on : panda-arc
115
+ steps :
116
+ - name : Check out
117
+ uses : actions/checkout@v4
118
+ with :
119
+ fetch-depth : 0
120
+
121
+ - name : Login to Docker Registry
71
122
uses : docker/login-action@v3
72
123
with :
73
124
username : pandare
74
125
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 }}
126
+
127
+ - name : Build pandadev:latest
128
+ uses : docker/build-push-action@v5
129
+ with :
130
+ push : true
131
+ context : ${{ github.workspace }}
132
+ tags : |
133
+ pandare/pandadev:${{ github.sha }}
134
+ pandare/pandadev:${{ needs.create_release.outputs.v-version }}
135
+ pandare/pandadev:latest
136
+ target : developer
137
+ cache-from : type=registry,ref=pandare/pandadev:cache
138
+ cache-to : type=registry,ref=pandare/pandadev:cache,mode=max
84
139
85
140
- name : Build panda:latest
86
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
87
141
uses : docker/build-push-action@v5
88
142
with :
89
143
push : true
@@ -92,119 +146,52 @@ jobs:
92
146
pandare/panda:${{ github.sha }}
93
147
pandare/panda:${{ needs.create_release.outputs.v-version }}
94
148
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
149
target : panda
99
- - name : Build pandadev:latest
100
- if : ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
150
+ cache-from : type=registry,ref=pandare/pandadev:cache
151
+ cache-to : type=registry,ref=pandare/panda:cache,mode=max
152
+
153
+ - name : Build Panda stable container
154
+ if : ${{ github.ref == 'refs/heads/stable' }}
101
155
uses : docker/build-push-action@v5
102
156
with :
103
157
push : true
104
158
context : ${{ github.workspace }}
105
159
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
113
- - 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
139
-
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'
160
+ pandare/panda_stable:${{ github.sha }}
161
+ pandare/panda_stable:${{ needs.create_release.outputs.v-version }}
162
+ pandare/panda_stable:latest
163
+ target : panda
164
+ cache-from : type=registry,ref=pandare/panda:cache
165
+ cache-to : type=registry,ref=pandare/panda_stable:cache,mode=max
166
+
167
+ update_documentation :
168
+ name : Update PYPANDA documentation
169
+ if : ${{ github.repository == 'panda-re/panda' }}
170
+ needs : [ upload_containers ]
166
171
runs-on : panda-arc
167
172
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
173
- name : Checkout docs and reset
189
174
run : rm -rf "${GITHUB_WORKSPACE}/auto_pydoc";
190
175
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
176
192
177
- name : Update PYPANDA docs in container
193
178
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
196
- #
197
- # This is a bit complicated, sorry. We create a directory stable and combine doc-search.html and index.js in there.
179
+
180
+ # will put docs in workspace/auto_pydoc/{dev, stable}/pandare and/or workspace/auto_pydoc/stable/pandare
181
+ # we want to copy auto_pydoc/{dev, stable}/pandare to auto_pydoc/pandare/ and /auto_pydoc/stable/pandare to /auto_pydoc/pandare/stable
182
+ #
183
+ # This is a bit complicated, sorry. We want to keep pandare/{CNAME,.git/} and nothing else
184
+ # then we copy in the new files (and merge doc-search.html and index.js with {dev, stable}/pandare/
198
185
- 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
186
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
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