Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 48 additions & 45 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,63 @@ jobs:
needs: build-jekyll
runs-on: macos-13
timeout-minutes: 10
permissions: read-all
steps:
- uses: actions/checkout@v4
with:
lfs: 'true'
- name: Download Jekyll Artifact
uses: actions/download-artifact@v3
with:
name: jekyll-site
path: _site
- uses: actions/checkout@v4
with:
lfs: 'true'
- name: Download Jekyll Artifact
uses: actions/download-artifact@v3
with:
name: jekyll-site
path: _site

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app

- name: Generate DocC docs
run: |
SCHEME="HVCaptureSDK"
- name: Generate DocC docs
run: |
SCHEME="HVCaptureSDK"

# have derivedData outside of project dir to avoid SPM cache issue? https://forums.swift.org/t/xcode-and-swift-package-manager/44704/5
TMP_BUILDIR="$HOME/doc-build"
mkdir -p ${TMP_BUILDIR}
DOCARCHIVE_DIR="tmp/docs"
mkdir -p ${DOCARCHIVE_DIR}
PAGE_DIR="tmp/site"
mkdir -p ${PAGE_DIR}
# have derivedData outside of project dir to avoid SPM cache issue? https://forums.swift.org/t/xcode-and-swift-package-manager/44704/5
TMP_BUILDIR="$HOME/doc-build"
mkdir -p ${TMP_BUILDIR}
DOCARCHIVE_DIR="tmp/docs"
mkdir -p ${DOCARCHIVE_DIR}
PAGE_DIR="tmp/site"
mkdir -p ${PAGE_DIR}

touch $HOME/.netrc
echo "machine api.github.com login hover-devops password ${{ secrets.DEVOPS_PAT }}" > $HOME/.netrc
touch $HOME/.netrc
echo "machine api.github.com" > $HOME/.netrc
echo "login ${{ secrets.GITHUB_TOKEN }}" >> $HOME/.netrc
echo "password ${{ secrets.GITHUB_TOKEN }}" >> $HOME/.netrc
Comment on lines +52 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure if we currently do, but we need to use a specific login and password for the CI system

Copy link
Contributor Author

@alrikai alrikai Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we have our hover-mobile-ci-user -- I am not really sure if GITHUB_TOKEN is the correct token to use, in theory GITHUB_TOKEN should work for accessing things within the same repo, so it seems like it'd be well suited for this (and we don't run the risk of the token getting invalidated unexpectedly like our DEVOPS_PAT, which caused this action to start failing to begin with). That said, if this PR doesn't work, then hover-mobile-ci-user will be the next thing I'd try.


# compile the DocC archive(s)
xcodebuild docbuild \
-scheme "${SCHEME}" \
-destination generic/platform=iOS \
-derivedDataPath "${TMP_BUILDIR}"
# collect the generated docarchive(s)
cp -R $(find ${TMP_BUILDIR} -type d -name "*.doccarchive") "${DOCARCHIVE_DIR}/."
# NOTE: this command seems to wipe out the path specified by --output-path, so use a tmp dir that you don't mind getting deleted (i.e. don't use _site as the output directory directly)
$(xcrun --find docc) process-archive transform-for-static-hosting "${DOCARCHIVE_DIR}/${SCHEME}.doccarchive" --hosting-base-path "hover-capture-ios" --output-path "${PAGE_DIR}"
# compile the DocC archive(s)
xcodebuild docbuild \
-scheme "${SCHEME}" \
-destination generic/platform=iOS \
-derivedDataPath "${TMP_BUILDIR}"
# collect the generated docarchive(s)
cp -R $(find ${TMP_BUILDIR} -type d -name "*.doccarchive") "${DOCARCHIVE_DIR}/."
# NOTE: this command seems to wipe out the path specified by --output-path, so use a tmp dir that you don't mind getting deleted (i.e. don't use _site as the output directory directly)
$(xcrun --find docc) process-archive transform-for-static-hosting "${DOCARCHIVE_DIR}/${SCHEME}.doccarchive" --hosting-base-path "hover-capture-ios" --output-path "${PAGE_DIR}"

# Copy DocC Output to Jekyll Site
mkdir -p _site/
# get rid of the DocC index.html, since it's an empty page anyways and we don't want to overwrite the Jekyll one
rm "${PAGE_DIR}"/index.html
cp -R "${PAGE_DIR}"/* _site/.
rm -rf "${TMP_BUILDIR}"
# Copy DocC Output to Jekyll Site
mkdir -p _site/
# get rid of the DocC index.html, since it's an empty page anyways and we don't want to overwrite the Jekyll one
rm "${PAGE_DIR}"/index.html
cp -R "${PAGE_DIR}"/* _site/.
rm -rf "${TMP_BUILDIR}"

- name: Fix GH-pages permissions
run: |
# from https://github.com/actions/upload-pages-artifact
chmod -v -R +rX "_site/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Fix GH-pages permissions
run: |
# from https://github.com/actions/upload-pages-artifact
chmod -v -R +rX "_site/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2

# Deploy github pages job
deploy:
Expand Down