Skip to content

Commit 6203b65

Browse files
committed
[CI] Add github pages deployment stage to azp
1 parent ab569e8 commit 6203b65

1 file changed

Lines changed: 40 additions & 3 deletions

File tree

azure-pipelines.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,43 @@ stages:
141141
swift.exe build %SWIFTFLAGS%
142142
swift.exe build -c release %SWIFTFLAGS%
143143
displayName: 'Build SPM Debug & Release'
144-
# - stage: Deploy
145-
# dependsOn: Test
146-
# condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') # Deploy on tags only
144+
- stage: deploy
145+
displayName: Deploy
146+
dependsOn: test
147+
# Deploy on tags only; test tags are excluded in trigger section.
148+
condition: and(not(eq(variables['Build.Reason'], 'PullRequest')), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
149+
jobs:
150+
- job: ghPages
151+
displayName: 'Publish API docs to GH Pages'
152+
pool:
153+
vmImage: 'macOS-10.15'
154+
variables:
155+
DEVELOPER_DIR: '/Applications/Xcode_12.4.app'
156+
steps:
157+
- script: |
158+
set -e -o xtrace
159+
brew update
160+
brew install sourcekitten
161+
gem install -N jazzy
162+
displayName: 'Install Tools'
163+
- task: InstallSSHKey@0
164+
inputs:
165+
knownHostsEntry: 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='
166+
sshPublicKey: '$(swcPubDeployKey)'
167+
sshKeySecureFile: 'swc_deploy_key'
168+
displayName: 'Install an SSH key'
169+
- script: git worktree add docs gh-pages
170+
displayName: 'Prepare Worktree'
171+
- script: ./utils.py ci before-deploy
172+
displayName: 'Before Deploy'
173+
- script: |
174+
set -e -o xtrace
175+
git config --local user.name "Azure Pipelines"
176+
git config --local user.email "azuredevops@microsoft.com"
177+
cd docs
178+
git add --all
179+
git commit -m "Deploy to GH Pages [skip ci]" --amend
180+
cd ..
181+
git remote set-url --push origin git@github.com:tsolomko/SWCompression.git
182+
git push --force origin gh-pages:gh-pages
183+
displayName: 'Deploy to GH Pages'

0 commit comments

Comments
 (0)