-
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (107 loc) · 3.49 KB
/
cd.yml
File metadata and controls
121 lines (107 loc) · 3.49 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Check if release needed
on:
workflow_call:
inputs:
os:
description: OS to build products on
required: false
type: string
default: macos-latest
swift:
description: Swift version to use
required: false
type: string
default: latest
version:
description: New version to release
required: false
type: string
secrets:
COCOAPODS_TRUNK_TOKEN:
description: CocoaPods Trunk Token to publish release
required: true
jobs:
changelog:
name: Generate release changelogs
runs-on: ubuntu-latest
outputs:
changelog: ${{ steps.changelog.outputs.changelog }}
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }}
version: ${{ steps.changelog.outputs.version }}
tag: ${{ steps.changelog.outputs.tag }}
skipped: ${{ steps.changelog.outputs.skipped }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup repository
uses: SwiftyLab/ci/actions/setup@main
with:
swift: ${{ inputs.swift }}
- name: Conventional Changelog Action
id: changelog
uses: SwiftyLab/ci/actions/changelog@main
with:
version: ${{ inputs.version }}
publish:
name: Build and Publish
if: needs.changelog.outputs.skipped == 'false'
needs: changelog
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ needs.changelog.outputs.tag }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
- name: Setup repository
uses: SwiftyLab/ci/actions/setup@main
with:
swift: ${{ inputs.swift }}
- name: Build package products and documentation
run: |
swift build --disable-experimental-prebuilts -Xswiftc -emit-symbol-graph -Xswiftc -emit-extension-block-symbols -Xswiftc -emit-symbol-graph-dir -Xswiftc .build
npm run build-doc
npm run serve-doc
npm run archive
- name: Release GitHub Pages
continue-on-error: true
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: .docc-build
target-folder: docs
clean: false
commit-message: 'chore(GitHub Pages): release site for tag ${{ needs.changelog.outputs.tag }}'
- name: Create GitHub Release
continue-on-error: true
uses: ncipollo/release-action@v1
with:
token: ${{ github.token }}
tag: ${{ needs.changelog.outputs.tag }}
body: ${{ needs.changelog.outputs.changelog }}
artifacts: '*.zip'
- name: Publish to CocoaPods trunk
uses: actions/github-script@v8.0.0
continue-on-error: true
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
with:
script: |
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const pushArgs = [
'trunk', 'push', '--skip-import-validation', '--skip-tests', '--allow-warnings', '--verbose'
];
if (pkg.pods) {
for (const pod of pkg.pods) {
await exec.exec('pod', [...pushArgs, '--synchronous', `${pod}.podspec`]);
}
} else {
await exec.exec('pod', pushArgs);
}
- name: Publish to Swift Package Registry
continue-on-error: true
uses: twodayslate/swift-package-registry@v0.0.2