Skip to content

Commit

Permalink
Merge branch 'main' into feature/ソーシャルカードプラグインを導入する
Browse files Browse the repository at this point in the history
  • Loading branch information
fkoyama committed Apr 26, 2024
2 parents 4428993 + 706c512 commit ec17a8f
Show file tree
Hide file tree
Showing 17 changed files with 795 additions and 285 deletions.
169 changes: 17 additions & 152 deletions .github/workflows/build-and-release-documents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,9 @@ name: ドキュメントのビルドとリリース

on:
push:
branches: [main]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-Beta[0-9]+'
pull_request:
branches: [main]
paths:
- "documents/**"
- "iis-files/**"
- "samples/**"
- ".github/workflows/build-and-release-documents.yml"
- ".markdownlint.yaml"
- ".textlintignore"
- ".textlintrc"
- ".yaml-lint.yml"
- "package-lock.json"
- "package.json"
- "requirements.txt"
workflow_dispatch:

permissions:
Expand All @@ -31,7 +16,10 @@ permissions:

env:
APP_ALESINFINY_MARIS_WEBAPP_NAME: app-alesinfiny-maris-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:
Expand All @@ -56,149 +44,26 @@ jobs:
with:
fetch-depth: 1

- name: Node.js のセットアップ
uses: actions/setup-node@v4
with:
node-version: 18

- name: npm パッケージのインストール
run: npm ci

- name: Python のセットアップ
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: pip パッケージのインストール
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Linter の処理開始
run: echo '# Linter Result :newspaper:' >> $GITHUB_STEP_SUMMARY

- name: Markdownlint の実行
id: run-markdownlint
- name: ドキュメントの Lint
continue-on-error: true
run: |
echo '## Markdownlint Result' >> $GITHUB_STEP_SUMMARY
npx markdownlint --config .markdownlint.yaml --ignore **/node_modules/** --output markdownlint-result.txt .
echo ':heavy_check_mark: Markdownlint に成功しました。' >> $GITHUB_STEP_SUMMARY
- name: Markdownlint 失敗時の結果表示
if: ${{ steps.run-markdownlint.outcome == 'failure' }}
run: |
echo ':x: Markdownlint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat markdownlint-result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'LINT_STATUS=Error' >> $GITHUB_ENV
uses: ./.github/workflows/lint-documents

- name: yamllint の実行
id: run-yamllint
continue-on-error: true
run: |
echo '## yamllint Result' >> $GITHUB_STEP_SUMMARY
yamllint --config-file .yaml-lint.yml --format standard . > yamllint-result.txt
echo ':heavy_check_mark: yamllint に成功しました。' >> $GITHUB_STEP_SUMMARY
- name: yamllint 失敗時の結果表示
if: ${{ steps.run-yamllint.outcome == 'failure' }}
run: |
echo ':x: yamllint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat yamllint-result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'LINT_STATUS=Error' >> $GITHUB_ENV
- name: textlint の実行
run: |
echo '## textlint Result' >> $GITHUB_STEP_SUMMARY
npx textlint documents samples --output-file textlint-result.txt --format compact
if [ -f textlint-result.txt ]; then
echo ':x: textlint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat textlint-result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'LINT_STATUS=Error' >> $GITHUB_ENV
else
echo ':heavy_check_mark: textlint に成功しました。' >> $GITHUB_STEP_SUMMARY
fi
- name: Lint 結果の確認
if: ${{ env.LINT_STATUS == 'Error' }}
run: exit 1

- name: dressca.zip の作成
run: |
cd samples/Dressca
zip -r ../../documents/contents/samples/downloads/dressca.zip *
- name: console-app-with-di.zip の作成
run: |
cd samples/ConsoleAppWithDI
zip -r ../../documents/contents/samples/downloads/console-app-with-di.zip *
- name: azure-ad-b2c-auth.zip の作成
run: |
cd samples/AzureADB2CAuth
zip -r ../../documents/contents/samples/downloads/azure-ad-b2c-auth.zip *
- name: ソーシャルカードプラグイン用のパッケージインストール
run: |
python -m pip install "mkdocs-material[imaging]"
sudo apt-get install pngquant
- name: サンプルアプリケーションのソースコード圧縮
uses: ./.github/workflows/compress-sample-source
with:
compressed-source-path: ${{ env.DOCUMENT_BASE_PATH }}/${{ env.COMPRESSED_SOURCE_PATH }}

- name: ドキュメントのビルド
id: build_documents
continue-on-error: true
run: |
export BUILD_DOCUMENTS=true
if [ ${{ startsWith(github.ref, 'refs/tags/v') }} ];
then
export VERSION="${{ github.ref_name }}"
else
export VERSION="Test Version"
fi
cd documents
echo '# Mkdocs Build Result :factory:' >> $GITHUB_STEP_SUMMARY
mkdocs build --verbose --clean --strict > mkdocs_build_log.txt
- name: ドキュメントビルドの結果表示(成功)
if: ${{ steps.build_documents.outcome == 'success' }}
run: |
echo ':heavy_check_mark: mkdocs のビルドに成功しました。' >> $GITHUB_STEP_SUMMARY
cd documents
if [ -s mkdocs_build_log.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
cat mkdocs_build_log.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
- name: ドキュメントビルドの結果表示(失敗)
if: ${{ steps.build_documents.outcome == 'failure' }}
run: |
echo ':x: mkdocs のビルドに失敗しました。' >> $GITHUB_STEP_SUMMARY
cd documents
if [ -s mkdocs_build_log.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
cat mkdocs_build_log.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
exit 1
- name: IIS 用のファイル配置とパッケージング
run: |
cp -T -v -f -r iis-files documents/build-artifacts/
cd documents/build-artifacts
zip -r ../${{ env.DOCUMENT_ARTIFACTS_FILENAME }} *
uses: ./.github/workflows/build-documents
with:
document-base-path: ${{ env.DOCUMENT_BASE_PATH }}
output-folder-name: ${{ env.DOCUMENT_OUTPUT_FOLDER_NAME }}

- name: ビルドアーティファクトのアップロード
uses: actions/upload-artifact@v4
- name: ビルドアーティファクトのパッケージングとアップロード
uses: ./.github/workflows/pack-and-upload
with:
name: documents
path: documents/${{ env.DOCUMENT_ARTIFACTS_FILENAME }}
retention-days: 7
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のリリース
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/build-documents-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
# cSpell:ignore endgroup fjogeleit markdownlint pymdown softprops textlintignore textlintrc webapps

name: ドキュメントのビルド(CI用)

on:
pull_request:
branches: [main]
paths:
- "documents/**"
- "iis-files/**"
- "samples/**"
- ".github/workflows/build-documents-ci.yml"
- ".github/workflows/build-and-release-documents.yml"
- ".github/workflows/lint-documents/action.yml"
- ".github/workflows/compress-sample-source/action.yml"
- ".github/workflows/build-documents/action.yml"
- ".github/workflows/pack-and-upload/action.yml"
- ".markdownlint.yaml"
- ".textlintignore"
- ".textlintrc"
- ".yaml-lint.yml"
- "package-lock.json"
- "package.json"
- "requirements.txt"
workflow_dispatch:

env:
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
steps:
- name: ブランチのチェックアウト
uses: actions/checkout@v4
with:
fetch-depth: 1

- 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: ビルドアーティファクトのパッケージングとアップロード
if: github.event_name == 'workflow_dispatch'
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 }}
74 changes: 74 additions & 0 deletions .github/workflows/build-documents/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: "ドキュメントのビルド"
description: "ドキュメントをビルドします。"
inputs:
document-base-path:
description: "ドキュメントのベースフォルダパス"
required: true
output-folder-name:
description: "ビルドしたドキュメントの出力先フォルダ名"
required: true
runs:
using: "composite"
steps:
- name: Python のセットアップ
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: pip パッケージのインストール
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: ソーシャルカードプラグイン用のパッケージインストール
shell: bash
run: |
python -m pip install "mkdocs-material[imaging]"
sudo apt-get install pngquant
- id: setup-version
name: ドキュメントのバージョン設定
shell: bash
run: |
if [ ${{ startsWith(github.ref, 'refs/tags/v') }} ];
then
export VERSION="${{ github.ref_name }}"
else
export VERSION="Test Version"
fi
- name: ドキュメントのビルド
id: build_documents
continue-on-error: true
shell: bash
run: |
export BUILD_DOCUMENTS=true
cd "${{ inputs.document-base-path }}"
echo '# Mkdocs Build Result :factory:' >> $GITHUB_STEP_SUMMARY
mkdocs build --verbose --clean --strict --site-dir "${{ inputs.output-folder-name }}" > mkdocs_build_log.txt
- name: ドキュメントビルドの結果表示(成功)
if: ${{ steps.build_documents.outcome == 'success' }}
shell: bash
run: |
echo ':heavy_check_mark: mkdocs のビルドに成功しました。' >> $GITHUB_STEP_SUMMARY
cd "${{ inputs.document-base-path }}"
if [ -s mkdocs_build_log.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
cat mkdocs_build_log.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
- name: ドキュメントビルドの結果表示(失敗)
if: ${{ steps.build_documents.outcome == 'failure' }}
shell: bash
run: |
echo ':x: mkdocs のビルドに失敗しました。' >> $GITHUB_STEP_SUMMARY
cd "${{ inputs.document-base-path }}"
if [ -s mkdocs_build_log.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
cat mkdocs_build_log.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
exit 1
27 changes: 27 additions & 0 deletions .github/workflows/compress-sample-source/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "サンプルアプリケーションのソースコード圧縮"
description: "サンプルアプリケーションのソースコードを圧縮します。"
inputs:
compressed-source-path:
description: "圧縮したソースコードを配置するフォルダのGITHUB_WORKSPACEからの相対パス"
required: true

runs:
using: "composite"
steps:
- name: dressca.zip の作成
shell: bash
run: |
cd samples/Dressca
zip -r ${GITHUB_WORKSPACE}/${{ inputs.compressed-source-path }}/dressca.zip *
- name: console-app-with-di.zip の作成
shell: bash
run: |
cd samples/ConsoleAppWithDI
zip -r ${GITHUB_WORKSPACE}/${{ inputs.compressed-source-path }}/console-app-with-di.zip *
- name: azure-ad-b2c-auth.zip の作成
shell: bash
run: |
cd samples/AzureADB2CAuth
zip -r ${GITHUB_WORKSPACE}/${{ inputs.compressed-source-path }}/azure-ad-b2c-auth.zip *
Loading

0 comments on commit ec17a8f

Please sign in to comment.