Skip to content

Commit 087b616

Browse files
committed
Add support for Swift 5.9, drop support for previous versions of Swift
1 parent 4942d75 commit 087b616

12 files changed

+177
-421
lines changed

CODEOWNERS renamed to .github/CODEOWNERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
# Workflow & Deployment related files
55
.github/* @ffried
6-
.jazzy.yaml @ffried
76
.codecov.yml @ffried
87

98
# Project & Source files
109
*.swift @ffried
11-
/Package.* @ffried
10+
/Package*.swift @ffried
1211
/Sources/* @ffried
1312
/Tests/* @ffried

.github/dependabot.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
version: 2
22

33
updates:
4-
- package-ecosystem: "github-actions"
5-
directory: "/"
4+
- package-ecosystem: github-actions
5+
directory: /
66
open-pull-requests-limit: 10
77
schedule:
8-
interval: "daily"
9-
time: "07:00"
10-
timezone: "Europe/Berlin"
8+
interval: daily
9+
time: 07:00
10+
timezone: Europe/Berlin
11+
assignees:
12+
- ffried
13+
reviewers:
14+
- ffried
15+
- package-ecosystem: swift
16+
directory: /
17+
open-pull-requests-limit: 10
18+
schedule:
19+
interval: daily
20+
time: 07:00
21+
timezone: Europe/Berlin
1122
assignees:
1223
- ffried
1324
reviewers:

.github/workflows/docs.yml

Lines changed: 14 additions & 224 deletions
Original file line numberDiff line numberDiff line change
@@ -8,229 +8,19 @@ on:
88
push:
99
branches: [ main ]
1010

11-
jobs:
12-
release-context:
13-
runs-on: ubuntu-latest
14-
outputs:
15-
version-name: ${{ github.ref_name }}
16-
is-latest: ${{ steps.compare-tags.outputs.is-latest }}
17-
steps:
18-
- uses: joutvhu/get-release@v1
19-
id: latest-release
20-
with:
21-
latest: true
22-
throwing: false
23-
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
- name: Compare tags
26-
id: compare-tags
27-
env:
28-
REF_TYPE: ${{ github.ref_type }}
29-
REF_NAME: ${{ github.ref_name }}
30-
LATEST_TAG: ${{ steps.latest-release.outputs.tag_name }}
31-
run: |
32-
if [ "${REF_TYPE}" == 'tag' ] && [ "${REF_NAME}" == "${LATEST_TAG}" ]; then
33-
echo 'is-latest=true' >> "${GITHUB_OUTPUT}"
34-
else
35-
echo 'is-latest=false' >> "${GITHUB_OUTPUT}"
36-
fi
37-
38-
spm-context:
39-
runs-on: ubuntu-latest
40-
outputs:
41-
package-dump: ${{ steps.dump-package.outputs.package-dump }}
42-
steps:
43-
- uses: swift-actions/setup-swift@v1.24.0
44-
with:
45-
swift-version: '5.8'
46-
- uses: actions/checkout@v4
47-
# We don't use a cache here, because SPM doesn't resolve dependencies when dumping packages.
48-
- name: Dump package
49-
id: dump-package
50-
run: |
51-
delimiter="$(openssl rand -hex 8)"
52-
echo "package-dump<<${delimiter}" >> "${GITHUB_OUTPUT}"
53-
swift package dump-package >> "${GITHUB_OUTPUT}"
54-
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
11+
permissions:
12+
contents: write
5513

56-
generate-docs:
57-
needs:
58-
- release-context
59-
- spm-context
60-
runs-on: ubuntu-latest
61-
strategy:
62-
matrix:
63-
target: ${{ fromJson(needs.spm-context.outputs.package-dump).products.*.targets.* }}
64-
steps:
65-
- uses: swift-actions/setup-swift@v1.24.0
66-
id: swift-setup
67-
with:
68-
swift-version: '5.8'
69-
- name: Read OS Version
70-
uses: sersoft-gmbh/os-version-action@v3
71-
id: os-version
72-
- uses: actions/checkout@v4
73-
- uses: actions/cache@v3
74-
with:
75-
path: .build
76-
key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-setup.outputs.version }}-${{ hashFiles('**/Package.resolved') }}
77-
restore-keys: |
78-
${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-setup.outputs.version }}-
79-
- uses: sersoft-gmbh/swifty-docs-action@v3
80-
env:
81-
ENABLE_DOCC_SUPPORT: '1'
82-
DOCC_JSON_PRETTYPRINT: 'YES'
83-
with:
84-
package-version: ${{ needs.release-context.outputs.version-name }}
85-
targets: ${{ matrix.target }}
86-
enable-inherited-docs: true
87-
enable-index-building: false
88-
transform-for-static-hosting: true
89-
hosting-base-path: ${{ github.event.repository.name }}/${{ needs.release-context.outputs.version-name }}
90-
output: ${{ matrix.target }}-docs
91-
- name: Package docs
92-
env:
93-
TARGET: ${{ matrix.target }}
94-
run: tar -cvf "${TARGET}-docs.tar" "${TARGET}-docs"
95-
- uses: actions/upload-artifact@v3
96-
with:
97-
name: ${{ matrix.target }}-docs
98-
path: ${{ matrix.target }}-docs.tar
14+
concurrency:
15+
group: ${{ github.ref }}
16+
cancel-in-progress: true
9917

100-
publish-docs:
101-
needs:
102-
- release-context
103-
- spm-context
104-
- generate-docs
105-
runs-on: ubuntu-latest
106-
steps:
107-
- uses: actions/checkout@v4
108-
with:
109-
ref: gh-pages
110-
path: repository
111-
- uses: actions/download-artifact@v3
112-
with:
113-
path: artifacts
114-
- name: Extract tars
115-
run: find artifacts -name '*.tar' -execdir tar -xvf '{}' --strip-components 1 \; -delete
116-
- name: Merge documentations
117-
env:
118-
TARGETS: ${{ join(fromJson(needs.spm-context.outputs.package-dump).products.*.targets.*, ' ') }}
119-
DOCS_BASE_DIR: repository/${{ needs.release-context.outputs.version-name }}
120-
run: |
121-
rm -rf "${DOCS_BASE_DIR}"
122-
is_first=1
123-
for target in $TARGETS; do
124-
if [ $is_first -eq 1 ]; then
125-
echo "Copying initial documentation for ${target}"
126-
cp -R "artifacts/${target}-docs" "${DOCS_BASE_DIR}"
127-
is_first=0
128-
else
129-
echo "Merging documentation for ${target}"
130-
cp -R "artifacts/${target}-docs/data/documentation/"* "${DOCS_BASE_DIR}/data/documentation/"
131-
cp -R "artifacts/${target}-docs/documentation/"* "${DOCS_BASE_DIR}/documentation/"
132-
fi
133-
done
134-
echo "Deleting non-mergable metadata.json"
135-
rm -f "${DOCS_BASE_DIR}/metadata.json"
136-
- name: Create version index
137-
working-directory: repository
138-
env:
139-
TARGET_DOCS_DIR: ${{ needs.release-context.outputs.version-name }}/documentation
140-
INDEX_FILE: ${{ needs.release-context.outputs.version-name }}/index.html
141-
BASE_URL: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ needs.release-context.outputs.version-name }}/documentation'
142-
REPO_NAME: ${{ github.event.repository.name }}
143-
run: |
144-
target_count=0
145-
target_list=""
146-
single_target_name=""
147-
for target in $(ls "${TARGET_DOCS_DIR}"); do
148-
if [ -d "${TARGET_DOCS_DIR}/${target}" ]; then
149-
single_target_name="${target}"
150-
target_count=$((target_count+1))
151-
target_list="${target_list}<li><a href=\"${BASE_URL}/${target}\"><code>${target}</code> Documentation</a></li>"
152-
fi
153-
done
154-
if [ ${target_count} -gt 1 ]; then
155-
echo "Found ${target_count} targets. Generating list..."
156-
cat > "${INDEX_FILE}" <<EOF
157-
<!DOCTYPE html>
158-
<html>
159-
<head>
160-
<title>${REPO_NAME} Documentation</title>
161-
</head>
162-
<body>
163-
<ul>
164-
${target_list}
165-
</ul>
166-
</body>
167-
</html>
168-
EOF
169-
else
170-
echo "Found one target. Generating redirect file to target ${single_target_name}"
171-
cat > "${INDEX_FILE}" <<EOF
172-
<!DOCTYPE html>
173-
<html>
174-
<head>
175-
<title>${REPO_NAME} Documentation</title>
176-
<meta http-equiv="refresh" content="0; url=${BASE_URL}/${single_target_name}" />
177-
</head>
178-
<body>
179-
<p>Redirecting...</p>
180-
</body>
181-
</html>
182-
EOF
183-
fi
184-
- name: Create root index
185-
working-directory: repository
186-
env:
187-
REDIRECT_URL: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/latest'
188-
REPO_NAME: ${{ github.event.repository.name }}
189-
run: |
190-
cat > 'index.html' <<EOF
191-
<!DOCTYPE html>
192-
<html>
193-
<head>
194-
<title>${REPO_NAME} Documentation</title>
195-
<meta http-equiv="refresh" content="0; url=${REDIRECT_URL}" />
196-
</head>
197-
<body>
198-
<p>Redirecting...</p>
199-
</body>
200-
</html>
201-
EOF
202-
- name: Create latest symlink
203-
if: ${{ needs.release-context.outputs.is-latest }}
204-
working-directory: repository
205-
env:
206-
VERSION_NAME: ${{ needs.release-context.outputs.version-name }}
207-
run: |
208-
rm -f 'latest'
209-
ln -s "${VERSION_NAME}" 'latest'
210-
- name: Determine changes
211-
id: check-changes
212-
working-directory: repository
213-
run: |
214-
if [ -n "$(git status --porcelain)" ]; then
215-
echo 'has-changes=true' >> "${GITHUB_OUTPUT}"
216-
else
217-
echo 'has-changes=false' >> "${GITHUB_OUTPUT}"
218-
fi
219-
- uses: crazy-max/ghaction-github-pages@v4
220-
if: ${{ steps.check-changes.outputs.has-changes }}
221-
with:
222-
keep_history: true
223-
build_dir: repository
224-
commit_message: Deploy documentation for '${{ needs.release-context.outputs.version-name }}'
225-
env:
226-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227-
228-
cleanup:
229-
needs:
230-
- generate-docs
231-
- publish-docs
232-
if: ${{ always() }}
233-
runs-on: ubuntu-latest
234-
steps:
235-
- name: Cleanup Artifacts
236-
uses: joutvhu/delete-artifact@v1
18+
jobs:
19+
generate-and-publish-docs:
20+
uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-generate-and-publish-docs.yml@main
21+
with:
22+
os: ubuntu
23+
swift-version: '5.9'
24+
organisation: ${{ github.repository_owner }}
25+
repository: ${{ github.event.repository.name }}
26+
pages-branch: gh-pages

.github/workflows/enable-auto-merge.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Auto-merge for Dependabot PRs
22

3-
on: pull_request
3+
on:
4+
pull_request:
5+
branches: [ main ]
46

57
permissions:
68
contents: write

0 commit comments

Comments
 (0)