Skip to content
Merged
Show file tree
Hide file tree
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
36 changes: 36 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Documentations

on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
build-docs:
runs-on: macos-12

steps:
- uses: actions/checkout@v3
- name: Set name in local git-config
run: git config --local user.name "runner"
- name: Setup git worktree
run: git worktree add --checkout gh-pages origin/gh-pages
- name: Generate/update /gh-pages/docs
run: make DOCUMENTATION_PATH=./gh-pages/docs generate-documentation
- name: Push to gh-pages branch
run: |
CURRENT_COMMIT_HASH=`git rev-parse --short HEAD`

cd gh-pages
git add docs

if [ -n "$(git status --porcelain)" ]; then
git commit -m "Update GitHub Pages documentation site to '$CURRENT_COMMIT_HASH'."
git push origin HEAD:gh-pages
else
echo "No documentation changes found."
fi

cd ..
- name: Clear git worktree
run: git worktree remove gh-pages
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DOCUMENTATION_PATH?=./docs
TARGET=MultipartFormData
HOSTING_PATH=swift-mulipart-formdata

all: generate-documentation

generate-documentation:
swift package \
--allow-writing-to-directory $(DOCUMENTATION_PATH) \
generate-documentation \
--target $(TARGET) \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path $(HOSTING_PATH) \
--output-path $(DOCUMENTATION_PATH)
16 changes: 16 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@

import PackageDescription

#if swift(>=5.6) && os(macOS)
let dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
]
#else
let dependencies: [Package.Dependency] = []
#endif

let package = Package(
name: "swift-multipart-formdata",
products: [
.library(
name: "MultipartFormData",
targets: ["MultipartFormData"]),
],
dependencies: dependencies,
targets: [
.target(
name: "MultipartFormData",
Expand Down