This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
167 lines (153 loc) · 7.82 KB
/
publish.yml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Publish
on:
release:
types: [published]
jobs:
formula:
name: Update Homebrew formula
runs-on: ubuntu-latest
steps:
- name: Update the Homebrew formula with latest release
uses: NSHipster/update-homebrew-formula-action@main
with:
repository: SwiftDocOrg/swift-doc
tap: SwiftDocOrg/homebrew-formulae
formula: Formula/swift-doc.rb
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
bottle_macos_catalina:
name: Build and distribute Homebrew bottle for macOS Catalina
runs-on: macos-10.15
needs: [formula]
steps:
- name: Build a bottle using Homebrew
run: |
brew tap swiftdocorg/formulae
brew install --build-bottle --verbose swift-doc
brew bottle swift-doc
- name: Upload the bottle to the GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./swift-doc--${{ github.event.release.tag_name }}.catalina.bottle.1.tar.gz
asset_name: swift-doc-${{ github.event.release.tag_name }}.catalina.bottle.1.tar.gz
asset_content_type: application/gzip
bottle_macos_big_sur:
name: Build and distribute Homebrew bottle for macOS Big Sur
runs-on: macos-11.0
needs: [formula]
steps:
- name: Build a bottle using Homebrew
run: |
brew tap swiftdocorg/formulae
brew install --build-bottle --verbose swift-doc
brew bottle swift-doc
- name: Upload the bottle to the GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./swift-doc--${{ github.event.release.tag_name }}.big_sur.bottle.1.tar.gz
asset_name: swift-doc-${{ github.event.release.tag_name }}.big_sur.bottle.1.tar.gz
asset_content_type: application/gzip
update_formula_bottle:
name: Update the Homebrew formula again with bottle
runs-on: ubuntu-latest
needs:
- bottle_macos_catalina
- bottle_macos_big_sur
steps:
- uses: NSHipster/update-homebrew-formula-action@main
with:
repository: SwiftDocOrg/swift-doc
tap: SwiftDocOrg/homebrew-formulae
formula: Formula/swift-doc.rb
message: |
Add bottles for swift-doc ${{ github.event.release.tag_name }}
on macOS 10.15 (Catalina) and macOS 11.0 (Big Sur)
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
windows_msi:
name: Build swift-doc.msi
runs-on: windows-latest
strategy:
matrix:
include:
- tag: 5.5-DEVELOPMENT-SNAPSHOT-2021-05-09-a
branch: swift-5.5-branch
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- name: Install Swift ${{ matrix.tag }}
run: |
Install-Binary -Url "https://swift.org/builds/${{ matrix.branch }}/windows10/swift-${{ matrix.tag }}/swift-${{ matrix.tag }}-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
- name: Set Environment Variables
run: |
echo "SDKROOT=C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "DEVELOPER_DIR=C:\Library\Developer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Adjust Paths
run: |
echo "C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Supporting Files
run: |
Copy-Item "$env:SDKROOT\usr\share\ucrt.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\ucrt\module.modulemap"
Copy-Item "$env:SDKROOT\usr\share\visualc.modulemap" -destination "$env:VCToolsInstallDir\include\module.modulemap"
Copy-Item "$env:SDKROOT\usr\share\visualc.apinotes" -destination "$env:VCToolsInstallDir\include\visualc.apinotes"
Copy-Item "$env:SDKROOT\usr\share\winsdk.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\um\module.modulemap"
- name: Fetch libxml2
run: |
Invoke-WebRequest -Uri "https://artprodeus21.artifacts.visualstudio.com/A8fd008a0-56bc-482c-ba46-67f9425510be/3133d6ab-80a8-4996-ac4f-03df25cd3224/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2NvbXBuZXJkL3Byb2plY3RJZC8zMTMzZDZhYi04MGE4LTQ5OTYtYWM0Zi0wM2RmMjVjZDMyMjQvYnVpbGRJZC8zNTI5NS9hcnRpZmFjdE5hbWUveG1sMi13aW5kb3dzLXg2NA2/content?format=zip" -OutFile $env:Temp\xml-windows-x64.zip
Expand-Archive -Path $env:Temp\xml-windows-x64.zip -DestinationPath $env:Temp -Force
Move-Item -Path $env:Temp\xml2-windows-x64\Library\libxml2-development -Destination C:\Library\ -Force
- name: Fetch graphviz
run: |
Invoke-WebRequest -Uri "https://artprodeus21.artifacts.visualstudio.com/A8fd008a0-56bc-482c-ba46-67f9425510be/3133d6ab-80a8-4996-ac4f-03df25cd3224/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2NvbXBuZXJkL3Byb2plY3RJZC8zMTMzZDZhYi04MGE4LTQ5OTYtYWM0Zi0wM2RmMjVjZDMyMjQvYnVpbGRJZC81MTAzNC9hcnRpZmFjdE5hbWUvZ3JhcGh2aXotd2luZG93cy14NjQ1/content?format=zip" -OutFile $env:Temp\graphviz-windows-x64.zip
Expand-Archive -Path $env:Temp\graphviz-windows-x64.zip -Destination $env:Temp -Force
Move-Item -Path $env:Temp\graphviz-windows-x64\Library\graphviz-development -Destination C:\Library\ -Force
- name: Build
run: |
swift build -c release -Xlinker -LC:\Library\graphviz-development\usr\lib -Xcc -DLIBXML_STATIC -Xcc -IC:\Library\libxml2-development\usr\include -Xcc -IC:\Library\libxml2-development\usr\include\libxml2 -Xlinker -LC:\Library\libxml2-development\usr\lib -Xcc -IC:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\include -Xlinker -LC:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib
- name: Package
run: |
$ProductVersion=$env:GITHUB_REF.Replace('refs/tags/', '')
msbuild WiX/swift-doc.wixproj -nologo -p:Configuration=Release -p:OutputPath=$PWD\.build\artifacts -p:RunWixToolsOutOfProc=true -p:GRAPHVIZ_ROOT=C:\Library\graphviz-development -p:SWIFT_DOC_BUILD=$PWD\.build\release -p:ProductVersion=$ProductVersion
- name: Upload the installer to the GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .build\artifacts\swift-doc.msi
asset_name: swift-doc.msi
asset_content_type: application/octet-stream
docker:
name: Build and push Docker container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.release.tag_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: |
swiftdoc/swift-doc:latest
swiftdoc/swift-doc:${{ github.event.release.tag_name }}