Skip to content

開発環境構築に関する記述について細かな改善を行う (#1525) #1250

開発環境構築に関する記述について細かな改善を行う (#1525)

開発環境構築に関する記述について細かな改善を行う (#1525) #1250

# 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
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: ドキュメントのビルド
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