0.3.0 #13
Workflow file for this run
This file contains hidden or 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
| --- | |
| name: release | |
| on: | |
| schedule: | |
| - cron: '0 4 * * *' | |
| push: | |
| branches: | |
| - '**' | |
| release: | |
| types: | |
| - published | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| if: github.event_name != 'schedule' | |
| runs-on: [self-hosted, macOS] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| clean: true | |
| - name: Clear SwiftPM caches | |
| run: | | |
| rm -rf ~/.swiftpm | |
| rm -rf ~/Library/Caches/org.swift.swiftpm | |
| rm -rf ~/Library/org.swift.swiftpm | |
| rm -rf .swiftpm | |
| rm -rf .build | |
| - name: Run Tests | |
| run: swift test -v | |
| daily_test: | |
| if: github.event_name == 'schedule' | |
| runs-on: [self-hosted, macOS] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| clean: true | |
| - name: Clear SwiftPM caches | |
| run: | | |
| rm -rf ~/.swiftpm | |
| rm -rf ~/Library/Caches/org.swift.swiftpm | |
| rm -rf ~/Library/org.swift.swiftpm | |
| rm -rf .swiftpm | |
| rm -rf .build | |
| - name: Run Tests | |
| run: swift test -v | |
| docs: | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: [self-hosted, macOS] | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| clean: true | |
| - name: Generate DocC | |
| run: | | |
| set -euo pipefail | |
| DERIVED_DATA=".build/DerivedData" | |
| xcodebuild docbuild \ | |
| -scheme Extensions \ | |
| -destination "generic/platform=iOS" \ | |
| -derivedDataPath "$DERIVED_DATA" | |
| DOCCARCHIVE=$(find "$DERIVED_DATA" -path "*Build/Products/*/Extensions.doccarchive" -print -quit) | |
| if [ -z "${DOCCARCHIVE:-}" ]; then | |
| echo "DocC archive not found in $DERIVED_DATA" | |
| exit 1 | |
| fi | |
| xcrun docc process-archive transform-for-static-hosting \ | |
| "$DOCCARCHIVE" \ | |
| --output-path ./public \ | |
| --hosting-base-path extensions | |
| cat > ./public/index.html <<'EOF' | |
| <!doctype html> | |
| <meta http-equiv="refresh" content="0; url=/extensions/documentation/extensions/" /> | |
| <title>Extensions Documentation</title> | |
| EOF | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./public | |
| name: github-pages | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| needs: docs | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| notify_package_collection: | |
| # Only notify when an actual GitHub Release is published | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Trigger swift-package-collection rebuild | |
| env: | |
| COLLECTION_REPO: thatfactory/swift-package-collection | |
| WORKFLOW_FILE: release.yml | |
| REF: main | |
| GH_TOKEN: ${{ secrets.COLLECTION_TRIGGER_TOKEN }} | |
| SOURCE_REPO: ${{ github.repository }} | |
| SOURCE_VERSION: ${{ github.event.release.tag_name }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${GH_TOKEN:-}" ]; then | |
| echo "Missing COLLECTION_TRIGGER_TOKEN secret" | |
| exit 1 | |
| fi | |
| curl -sS -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $GH_TOKEN" \ | |
| "https://api.github.com/repos/$COLLECTION_REPO/actions/workflows/$WORKFLOW_FILE/dispatches" \ | |
| -d "{\"ref\":\"$REF\",\"inputs\":{\"source_repo\":\"$SOURCE_REPO\",\"source_version\":\"$SOURCE_VERSION\"}}" |