1.5.0 #54
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Documentation | |
# Controls when the action will run. | |
on: | |
workflow_dispatch: {} | |
push: | |
branches: | |
- master | |
paths: | |
- .github/workflows/Documentation.yaml | |
- ADPhotoKit/Classes/**.swift | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
env: | |
PACKAGE_NAME: ADPhotoKit | |
BUILD_DEST: generic/platform=iOS | |
BUILD_PRODUCT: Debug-iphoneos | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
generate-docc: | |
name: Build DocC Archives | |
runs-on: macos-13 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- name: Switch Xcode 🔄 | |
run: sudo xcode-select --switch /Applications/Xcode_15.0.app | |
- name: Generate DocC Archive 🪄 | |
run: xcodebuild -workspace .swiftpm/xcode/package.xcworkspace docbuild -scheme ${{ env.PACKAGE_NAME }} -derivedDataPath /tmp/docbuild -destination ${{ env.BUILD_DEST }} | |
- name: Zip It Up 🤐 | |
run: | | |
mv /tmp/docbuild/Build/Products/${{ env.BUILD_PRODUCT }}/${{ env.PACKAGE_NAME }}.doccarchive ${{ env.PACKAGE_NAME }}.doccarchive | |
zip -r ${{ env.PACKAGE_NAME }}.doccarchive.zip ${{ env.PACKAGE_NAME }}.doccarchive | |
- name: Upload DocC Artifact ⬆️ | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.PACKAGE_NAME }}.doccarchive.zip | |
path: ${{ env.PACKAGE_NAME }}.doccarchive.zip | |
- name: Upload DocC Archive to GitHub release ⬆️ | |
if: github.event.release | |
uses: svenstaro/[email protected] | |
with: | |
file: ${{ env.PACKAGE_NAME }}.doccarchive.zip | |
asset_name: ${{ env.PACKAGE_NAME }}.doccarchive.zip | |
tag: ${{ github.ref_name }} | |
publish: | |
name: Publish Documentation Site 🛜 | |
# if: github.event.release.prerelease == false && github.event.release.draft == false && github.event.release.tag_name == github.event.repository.default_branch | |
runs-on: macos-13 | |
needs: generate-docc | |
steps: | |
- name: Download DocC Archive ⬇️ | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.PACKAGE_NAME }}.doccarchive.zip | |
- name: Unzip Archive 😮 | |
run: | | |
unzip ${{ env.PACKAGE_NAME }}.doccarchive.zip | |
ls -li ${{ env.PACKAGE_NAME }}.doccarchive | |
- name: lowercase Package Name 🔤 | |
id: package-name | |
uses: vishalmamidi/lowercase-action@v1 | |
with: | |
string: ${{ env.PACKAGE_NAME }} | |
- name: Build Static Website 🎈 | |
run: | | |
$(xcrun --find docc) process-archive \ | |
transform-for-static-hosting ${{ env.PACKAGE_NAME }}.doccarchive \ | |
--hosting-base-path ${{ github.event.repository.name }} \ | |
--output-path docs | |
echo "<script>window.location.href += \"/documentation/${{ steps.package-name.outputs.lowercase }}\"</script>" > docs/index.html | |
- name: Upload artifact ⬆️ | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: 'docs' | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: 'docs' | |
# - name: Deploy to GitHub Pages 📑 | |
# id: deployment | |
# uses: actions/deploy-pages@v2 |