-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (127 loc) · 5.07 KB
/
build-and-release-documents.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
# cSpell:ignore endgroup fjogeleit markdownlint softprops textlintrc webapps
name: ドキュメントのビルドとリリース
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-Beta[0-9]+'
workflow_dispatch:
permissions:
id-token: write
contents: write
env:
APP_ALESINFINY_MAIA_WEBAPP_NAME: app-alesinfiny-maia-docs-prod
DOCUMENT_BASE_PATH: documents
DOCUMENT_OUTPUT_FOLDER_NAME: build-artifacts
DOCUMENT_ARTIFACTS_FILENAME: docs.zip
COMPRESSED_SOURCE_PATH: contents/samples/downloads
CLA_FILE_INPUT_PATH: documents/contents/assets/files/CLA.pdf
CLA_FILE_DESTINATION_PATH: documents/contents/downloads/
jobs:
build:
name: ドキュメントのビルド
runs-on: ubuntu-latest
outputs:
is_pre_release: ${{ steps.setup-variables.outputs.is_pre_release }}
steps:
- id: setup-variables
name: 変数の初期化
run: |
pre_release=false
if [[ "${{ github.ref_name }}" == *"Beta"* ]]; then
pre_release=true
fi
echo "is_pre_release:$pre_release"
echo "is_pre_release=$pre_release" >> $GITHUB_ENV
echo "is_pre_release=$pre_release" >> $GITHUB_OUTPUT
- name: ブランチのチェックアウト
uses: actions/checkout@v4
with:
fetch-depth: 1
- id: lint-documents
name: ドキュメントの Lint
continue-on-error: true
uses: ./.github/workflows/lint-documents
- name: サンプルアプリケーションのソースコード圧縮
uses: ./.github/workflows/compress-sample-source
with:
compressed-source-path: ${{ env.DOCUMENT_BASE_PATH }}/${{ env.COMPRESSED_SOURCE_PATH }}
- name: CLA ファイルのコピー
uses: ./.github/workflows/copy-cla-file
with:
cla-file-path: ${{ env.CLA_FILE_INPUT_PATH }}
cla-file-destination-path: ${{ env.CLA_FILE_DESTINATION_PATH }}
- name: ドキュメントのビルド
uses: ./.github/workflows/build-documents
with:
document-base-path: ${{ env.DOCUMENT_BASE_PATH }}
output-folder-name: ${{ env.DOCUMENT_OUTPUT_FOLDER_NAME }}
- name: Lint結果の成否判定
if: steps.lint-documents.outcome == 'failure'
run: |
exit 1;
- name: ビルドアーティファクトのパッケージングとアップロード
uses: ./.github/workflows/pack-and-upload
with:
packaging-folder-path: ${{ env.DOCUMENT_BASE_PATH }}/${{ env.DOCUMENT_OUTPUT_FOLDER_NAME }}
document-artifact-path: ${{ env.DOCUMENT_BASE_PATH }}/${{ env.DOCUMENT_ARTIFACTS_FILENAME }}
release-github:
name: Githubのリリース
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: ビルドアーティファクトのダウンロード
uses: actions/download-artifact@v4
with:
name: documents
- name: Githubのリリース
uses: softprops/action-gh-release@v2
with:
files: ${{ env.DOCUMENT_ARTIFACTS_FILENAME }}
generate_release_notes: true
prerelease: ${{ needs.build.outputs.is_pre_release }}
release-documents:
name: ドキュメントのリリース
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: ビルドアーティファクトのダウンロード
uses: actions/download-artifact@v4
with:
name: documents
- name: Azure に OIDC Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: ステージング環境へのデプロイ
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.APP_ALESINFINY_MAIA_WEBAPP_NAME }}
slot-name: staging
package: "${{ env.DOCUMENT_ARTIFACTS_FILENAME }}"
- name: Teams への通知
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.ALESINFINY_POST_MESSAGE_TO_TEAMS_URL }}
method: POST
contentType: application/json
data: '{"messageType": 0,"branchName": "${{ github.ref }}","actor": "${{ github.actor }}","sha": "${{ github.sha }}","eventName": "${{ github.event_name }}"}'
timeout: 30000
swap:
name: 本番環境への反映承認
needs: [build, release-github, release-documents]
if: needs.build.outputs.is_pre_release == 'false' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: 本番環境への反映承認
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.ALESINFINY_APPROVE_REQUEST_TO_TEAMS_URL }}
method: POST
contentType: application/json
data: '{"branchName": "${{ github.ref }}","actor": "${{ github.actor }}","sha": "${{ github.sha }}","eventName": "${{ github.event_name }}"}'
preventFailureOnNoResponse: true