Skip to content

Commit 44574e5

Browse files
authored
Merge pull request #20 from pranamphd/gh-pages-hygiene
docs(gh-pages): prevent SwiftPM artifacts from leaking into gh-pages
2 parents bd1a5b7 + ebf36b6 commit 44574e5

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/swift-cd.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,17 @@ jobs:
217217
run: |
218218
set -euo pipefail
219219
220-
DOCS_DIR="$(mktemp -d)"
220+
rm -rf site
221+
mkdir -p site
221222
222223
swift package \
223-
--allow-writing-to-directory "$DOCS_DIR" \
224+
--allow-writing-to-directory site \
224225
generate-documentation \
225226
--target "${PACKAGE_NAME}" \
226227
--disable-indexing \
227228
--transform-for-static-hosting \
228229
--hosting-base-path "digipin-swift" \
229-
--output-path "$DOCS_DIR"
230-
231-
echo "DOCS_DIR=$DOCS_DIR" >> "$GITHUB_ENV"
230+
--output-path site
232231
233232
# -------------------------------------------------
234233
# Publish latest docs to gh-pages
@@ -239,7 +238,7 @@ jobs:
239238
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
240239
run: |
241240
set -euo pipefail
242-
rm -rf Digipin.doccarchive site
241+
243242
git config user.name "github-actions[bot]"
244243
git config user.email "github-actions[bot]@users.noreply.github.com"
245244
@@ -251,14 +250,16 @@ jobs:
251250
git checkout --orphan gh-pages
252251
fi
253252
254-
# Remove old site contents
255253
git rm -rf . || true
256254
257-
# Copy new static content
258-
cp -R "$DOCS_DIR"/. .
255+
cp -R site/. .
256+
257+
ls -lah
259258
260259
git add .
261260
261+
git status
262+
262263
if git diff --cached --quiet; then
263264
echo "No documentation changes to publish."
264265
exit 0

0 commit comments

Comments
 (0)