-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core(workflows): プルリクエストに対し build を実行し "site/pull/番号" 以下にアップロード
- Loading branch information
1 parent
58047c4
commit 53c4183
Showing
4 changed files
with
116 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: cpprefjp-build | ||
description: "cpprefjp サイトをビルドするためのアクション" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Register SSH key | ||
env: | ||
CPPREFJP_GITHUB_IO_SECRETS: ${{ secrets.CPPREFJP_GITHUB_IO_SECRETS }} | ||
run: | | ||
mkdir -p $HOME/.ssh | ||
echo "$CPPREFJP_GITHUB_IO_SECRETS" > $HOME/.ssh/id_ed25519 | ||
chmod 600 $HOME/.ssh/id_ed25519 | ||
# site_generator | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: cpprefjp/site_generator | ||
path: site_generator | ||
- run: git submodule update -i | ||
working-directory: site_generator | ||
|
||
# kunai | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: cpprefjp/kunai | ||
path: site_generator/kunai | ||
- run: git submodule update -i | ||
working-directory: site_generator/kunai | ||
|
||
# cpprefjp.github.io | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: cpprefjp/cpprefjp.github.io | ||
path: site_generator/cpprefjp/cpprefjp.github.io | ||
|
||
# site | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: cpprefjp/site | ||
path: site_generator/cpprefjp/site | ||
# atom 生成のために全履歴が必要 | ||
fetch-depth: 0 | ||
- run: git submodule update -i | ||
working-directory: site_generator/cpprefjp/site | ||
|
||
# site | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: cpprefjp/image | ||
path: site_generator/cpprefjp/image | ||
|
||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
# 3.12でUndefined symbolエラーがでた | ||
|
||
# あとはスクリプトで頑張る | ||
- run: ./cpprefjp/site/.github/workflows/script/build.sh ${{ inputs.arguments }} | ||
working-directory: site_generator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,14 +33,43 @@ popd | |
pip3 install -r docker/requirements.txt | ||
python3 run.py settings.cpprefjp --concurrency=`nproc` | ||
|
||
# 生成されたサイトの中身を push | ||
pushd cpprefjp/cpprefjp.github.io | ||
# push するために ssh のリモートを追加する | ||
git remote add origin2 [email protected]:cpprefjp/cpprefjp.github.io.git | ||
|
||
git add ./ --all | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "cpprefjp-autoupdate" | ||
git commit -a -m "update automatically" | ||
git push origin2 master | ||
popd | ||
if (($# == 0)); then | ||
# 生成されたサイトの中身を push | ||
pushd cpprefjp/cpprefjp.github.io | ||
# push するために ssh のリモートを追加する | ||
git remote add origin2 [email protected]:cpprefjp/cpprefjp.github.io.git | ||
|
||
git add ./ --all | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "cpprefjp-autoupdate" | ||
git commit -a -m "update automatically" | ||
git push origin2 master | ||
popd | ||
|
||
elif [[ $1 == --pull ]]; then | ||
if [[ $2 ]]; then | ||
printf '%s\n' "プルリクエスト番号が指定されていません" >&2 | ||
exit 2 | ||
fi | ||
|
||
[email protected]:cpprefjp/site.git | ||
working_directory=cpprefjp/cpprefjp.github.io-site | ||
|
||
git remote add origin2 "$target_repository" | ||
git clone --depth=1 [email protected]:cpprefjp/site.git -b gh-pages "$working_directory" | ||
rm -rf "$working_directory/pull/$2" | ||
mkdir -p "$working_directory/pull/$2" | ||
cp -r cpprefjp/cpprefjp.github.io/* "$working_directory/pull/$2"/ | ||
pushd "$working_directory" | ||
git add ./ --all | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "cpprefjp-autoupdate" | ||
git commit -a -m "update automatically" | ||
git push origin2 gh-pages | ||
popd | ||
|
||
else | ||
printf '%s\n' "コマンドライン引数が認識できません: $1" >&2 | ||
exit 2 | ||
|
||
fi |