Generate C2A Core Reference #712
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
name: Generate C2A Core Reference | |
on: | |
schedule: | |
- cron: "0 19 * * *" | |
workflow_dispatch: | |
jobs: | |
generate_c2a_core_reference: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: pages | |
- name: install deps | |
run: | | |
sudo apt install -y doxygen graphviz | |
- name: clone c2a | |
shell: bash | |
run: | | |
mkdir temp && cd $_ | |
git clone --depth 1 https://github.com/ut-issl/c2a-core.git ./clone/c2a-core | |
cp -r ./clone/c2a-core/ ./c2a-core/ | |
cp -r ./clone/c2a-core/ ./c2a-core/Examples/minimum_user/src/src_core/ | |
rm -rf ./c2a-core/Examples/minimum_user/src/s2e_mockup | |
cd ./c2a-core/Examples/minimum_user/src/src_core/ | |
rm -rf ./Examples | |
rm -rf ./Docs | |
- name: get commit hash | |
id: c2a_commit | |
working-directory: ./temp/clone/c2a-core | |
run: | | |
hash=$(git rev-parse HEAD) | |
hash_short=$(git rev-parse --short HEAD) | |
echo "commit hash: ${hash}" | |
echo "commit hash(short): ${hash_short}" | |
echo "hash=${hash}" >> "$GITHUB_OUTPUT" | |
echo "hash_short=${hash_short}" >> "$GITHUB_OUTPUT" | |
- name: clean previous html | |
working-directory: ./docs | |
run: | | |
rm -rf ./c2a-core | |
mkdir ./c2a-core | |
git restore ./c2a-core/status_updated.json | |
- name: build | |
working-directory: ./temp/c2a-core/Examples/minimum_user | |
run: doxygen | |
- name: move files | |
working-directory: ./docs/c2a-core/html | |
run: mv * ../ | |
- name: add commit info for status badge | |
working-directory: ./docs/c2a-core | |
run: | | |
JSON=$(cat << EOS | |
{ | |
"schemaVersion": 1, | |
"label": "Target commit", | |
"message": "${{ steps.c2a_commit.outputs.hash_short }}", | |
"color": "orange" | |
} | |
EOS | |
) | |
echo "$JSON" | jq | tee ./status_commit.json | |
- name: add github link | |
working-directory: ./docs/c2a-core | |
run: | | |
cat > redirect.html << EOS | |
<meta http-equiv="refresh" content="1;URL=https://github.com/ut-issl/c2a-core/tree/${{ steps.c2a_commit.outputs.hash }}"> | |
EOS | |
- name: check diff | |
id: diff | |
working-directory: ./docs/c2a-core | |
run: | | |
git add . | |
if ! git diff --exit-code --cached; then | |
echo "diff" | |
echo "update=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "There is no update" | |
echo "update=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: add update date info for status badge | |
working-directory: ./docs/c2a-core | |
run: | | |
DATE=$(TZ=Asia/Tokyo date -u +"%Y-%m-%d %H:%M:%S") | |
JSON=$(cat << EOS | |
{ | |
"schemaVersion": 1, | |
"label": "Updated at", | |
"message": "${DATE}", | |
"color": "orange" | |
} | |
EOS | |
) | |
echo "$JSON" | jq | tee ./status_updated.json | |
- name: deploy | |
if: steps.diff.outputs.update == 'true' | |
run: | | |
git branch -a | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "update doxygen: C2A Core" | |
git push origin | |
echo "New reference is deployed!" |