Repository navigation
102 lines (89 loc) · 2.74 KB
/
Copy pathrelease.yml
File metadata and controls
102 lines (89 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
name: Release
run-name: Release ${{ github.event.release.tag_name }}
on:
release:
types:
- published
permissions:
actions: read
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test Release
runs-on: [self-hosted, macOS]
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
clean: true
- name: Run Tests
run: swift test -v
build_docs:
name: Build DocC
runs-on: [self-hosted, macOS]
needs: test
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
clean: true
- name: Generate DocC
run: |
set -euo pipefail
swift package --allow-writing-to-directory ./public generate-documentation \
--target CloudSaveKit \
--disable-indexing \
--output-path ./public \
--transform-for-static-hosting \
--hosting-base-path cloudsavekit
cat > ./public/index.html <<'INDEX'
<!doctype html>
<meta http-equiv="refresh" content="0; url=/cloudsavekit/documentation/cloudsavekit/" />
<title>CloudSaveKit Documentation</title>
INDEX
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v5
with:
path: ./public
name: github-pages
deploy_docs:
name: Deploy DocC
needs: build_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:
name: Notify Package Collection
runs-on: ubuntu-latest
needs: deploy_docs
steps:
- name: Trigger Swift Package Collection Rebuild
env:
COLLECTION_REPO: thatfactory/swift-package-collection
WORKFLOW_FILE: publish.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 --fail-with-body -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\"}}"