-
Notifications
You must be signed in to change notification settings - Fork 537
130 lines (114 loc) · 5.03 KB
/
azure-static-web-apps-nice-sea-0903fc310.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
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- test/ffv2-test
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- test/ffv2-test
stages:
- stage: build
displayName: 'Build website'
jobs:
- job: build_site
displayName: 'Build website'
dependsOn: upload_json
pool: Large
steps:
- checkout: self
submodules: false
clean: true
- task: DownloadPipelineArtifact@2
displayName: 'Copy api-extractor JSON to staging folder'
inputs:
source: current
artifact: api-extractor-combined
path: '$(Build.SourcesDirectory)/_api-extractor-temp/doc-models'
- template: templates/include-use-node-version.yml
- template: templates/include-install-pnpm.yml
parameters:
buildDirectory: $(Build.SourcesDirectory)/docs
- task: Bash@3
displayName: Install dependencies
inputs:
targetType: 'inline'
workingDirectory: $(Build.SourcesDirectory)/docs
script: |
pnpm i --frozen-lockfile
- task: Bash@3
displayName: Download and extract previous version API
inputs:
targetType: 'inline'
workingDirectory: $(Build.SourcesDirectory)
script: |
# Run helper script to read versions.json
output=$(node docs/readVersionData.js)
# Pipe script output and loop through each value in the array
if [ -n "$output" ]; then
echo "$output" | while IFS= read -r version; do
version=$(echo "$version" | sed 's/"//g')
echo "Version: $version"
echo "creating api-extractor-temp-$version folder"
mkdir -p $(Build.SourcesDirectory)/_api-extractor-temp-$version/doc-models
az storage blob download -f latest-$version.tar.gz -c 'api-extractor-json' -n latest-$version.tar.gz --account-name $(STORAGE_ACCOUNT) --account-key $(STORAGE_KEY) --overwrite --verbose
tar -xzf latest-$version.tar.gz -C _api-extractor-temp-$version/doc-models
done
fi
- task: Npm@1
displayName: npm run build:multi-version
inputs:
command: 'custom'
workingDir: $(Build.SourcesDirectory)/docs
customCommand: 'run build:multi-version'
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Generate SBOM'
inputs:
BuildDropPath: $(Build.SourcesDirectory)/docs/public
PackageName: 'fluidframework-docs'
PackageVersion: '$(Build.BuildId)'
- task: PublishPipelineArtifact@1
displayName: 'Publish site build artifact'
inputs:
targetPath: '$(Build.SourcesDirectory)/docs/public'
artifactName: 'fluidframework-docs'
publishLocation: 'pipeline'
- stage: deploy
displayName: 'Deploy website'
pool: Small
dependsOn: ['build', 'guardian']
jobs:
- build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_NICE_SEA_0903FC310 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/docs" # App source code path
api_location: "" # Api source code path - optional
output_location: "public" # Built app content directory - optional
skip_app_build: true # site was built in previous stage
###### End of Repository/Build Configurations ######
- close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_NICE_SEA_0903FC310 }}
action: "close"