Skip to content

Commit a57798e

Browse files
committed
Deduplicate files before upload
Signed-off-by: Addisu Z. Taddese <[email protected]>
1 parent 7f5476a commit a57798e

File tree

3 files changed

+51
-10
lines changed

3 files changed

+51
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,30 @@ jobs:
8181
concurrency:
8282
group: pages
8383
cancel-in-progress: false
84+
env:
85+
BUILD_DIR: merged_artifacts/
8486
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v4
8589
- uses: actions/download-artifact@v4
8690
with:
8791
merge-multiple: true
92+
path: ${{ env.BUILD_DIR }}
93+
- name: Deduplicate files
94+
run: |
95+
sudo apt-get install -y rdfind symlinks
96+
bash tools/deduplicate_files.sh $BUILD_DIR
8897
- name: Upload merged
8998
uses: actions/upload-artifact@v4
9099
with:
91100
name: website-docs-merged
92-
path: ./
101+
path: ${{ env.BUILD_DIR }}
93102
- name: Commit
94-
uses: peaceiris/actions-gh-pages@v4
95103
# The workflow upto this point is good for generating a preview,
96104
# but only commit to deploy if we are on the master branch (not a pull request).
97105
if: github.ref == 'refs/heads/master'
106+
uses: JamesIves/github-pages-deploy-action@v4
98107
with:
99-
github_token: ${{ secrets.GITHUB_TOKEN }}
100-
publish_dir: ./
101-
keep_files: true
108+
folder: ${{ env.BUILD_DIR }}
109+
clean-exclude: |
110+
api/*

.github/workflows/nightly-upload.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ jobs:
7474
pattern: api-docs-*
7575
merge-multiple: false
7676
- run: python3 tools/restructure_doxygen_artifacts.py --input ${{steps.download.outputs.download-path}} .api-out
77+
- name: Deduplicate files
78+
run: |
79+
sudo apt-get install -y rdfind symlinks
80+
bash tools/deduplicate_files.sh .api-out
7781
- uses: actions/upload-artifact@v4
7882
with:
7983
name: api-docs
@@ -84,9 +88,8 @@ jobs:
8488
# The workflow upto this point is good for generating a preview,
8589
# but only commit to deploy if we are on the master branch (not a pull request).
8690
if: github.ref == 'refs/heads/master'
87-
uses: peaceiris/actions-gh-pages@v4
91+
uses: JamesIves/github-pages-deploy-action@v4
8892
with:
89-
github_token: ${{ secrets.GITHUB_TOKEN }}
90-
publish_dir: ./.api-out
91-
destination_dir: api
92-
keep_files: true
93+
folder: ./.api-out
94+
target-folder: api
95+
clean: false

tools/deduplicate_files.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
# Copyright (C) 2025 Open Source Robotics Foundation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# This script uses the commands rdfind and symlinks to detect duplicates and
17+
# replace them with symlinks leaving only one copy from the list of duplicates.
18+
19+
if [[ $# -lt 1 ]]; then
20+
echo "deduplicate_files <directory>"
21+
exit 1
22+
fi
23+
24+
(
25+
cd ${1}
26+
rdfind -makeresultsfile false -makesymlinks true .
27+
symlinks -cr .
28+
)
29+

0 commit comments

Comments
 (0)