Skip to content

Merge pull request #270 from ma10/revise-yaml2x-20241119 #201

Merge pull request #270 from ma10/revise-yaml2x-20241119

Merge pull request #270 from ma10/revise-yaml2x-20241119 #201

Workflow file for this run

name: Publish HTML
on:
push:
tags: [ "*" ]
branches: [develop]
jobs:
release:
if: github.repository == 'freee/a11y-guidelines' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Extract Branch/Tag Names
run: |
echo "NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.9.x'
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
- name: install ja_JP.UTF-8 locale
run: |
sudo locale-gen ja_JP.UTF-8
sudo update-locale LANG=ja_JP.UTF-8
- name: Install the Latest pip
run: python -m pip install --upgrade pip
- name: Install required modules
run: python -m pip install -r requirements.txt --upgrade
- name: Prepare file upload directory with the archive directory
run: |
mkdir -p ${GITHUB_WORKSPACE}/upload/archive
mkdir -p ${GITHUB_WORKSPACE}/upload/en
- name: Download the existing archive files from S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete s3://${AWS_BUCKET}/archive/ ${GITHUB_WORKSPACE}/upload/archive/ --quiet
- name: Build HTML of all releases, with gtag.js, and OGP tags
env:
GTM_ID: ${{ secrets.GTM_ID }}
TZ: Asia/Tokyo
run: |
make BASE_URL=https://a11y-guidelines.freee.co.jp/ sphinx_options="-A gtm_id=${GTM_ID}" clean html
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload
make BASE_URL=https://a11y-guidelines.freee.co.jp/current/ sphinx_options="-A gtm_id=${GTM_ID}" clean html
mkdir -p ${GITHUB_WORKSPACE}/upload/current/en
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/current
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/current/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload/current
make clean
current_commit=$(git rev-parse HEAD)
rm -rf ${GITHUB_WORKSPACE}/upload/archive/${TAG}
for _tag in `git tag` ; do \
echo "Processing ${_tag}..." ; \
if [ ! -d ${GITHUB_WORKSPACE}/upload/archive/${_tag} ] ; then \
git checkout ${_tag} ; \
git submodule update --init --recursive ; \
if [ ! -f ./build.mk ]; then
build_procedure=0 ; \
else \
build_procedure=`make build-procedure-version` ; \
fi ; \
if [ ${build_procedure} -eq 0 ]; then
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=https://a11y-guidelines.freee.co.jp/archive/${_tag}/" html ; \
if [ -d ./data/json/schemas ]; then \
cp -r ./data/json/schemas ./build/html ; \
fi ; \
cp -r ./build/html ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
elif [ ${build_procedure} -eq 1 ]; then \
make BASE_URL=https://a11y-guidelines.freee.co.jp/archive/${_tag}/ sphinx_options="-A gtm_id=${GTM_ID}" clean html ; \
mkdir -p ${GITHUB_WORKSPACE}/upload/archive/${_tag}/en ; \
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/archive/${_tag}/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
else \
echo "Unknown build procedure version: ${build_procedure}" ; \
exit 1 ; \
fi ; \
make clean ; \
git checkout ${current_commit} ; \
git submodule update --init --recursive ; \
fi ; \
done
- name: Publish to S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete ${GITHUB_WORKSPACE}/upload/ s3://${AWS_BUCKET}/ --quiet
- name: Prepare the HTML Archive
env:
TZ: Asia/Tokyo
run: |
make BASE_URL=/ clean html
mv ./ja/build/html ./freee-a11y-guidelines-${TAG}
cp -r ./data/json/schemas ./freee-a11y-guidelines-${TAG}
cp -r ./en/build/html ./freee-a11y-guidelines-${TAG}/en
zip -r ${GITHUB_WORKSPACE}/freee-a11y-guidelines-${TAG}-html.zip ./freee-a11y-guidelines-${TAG}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${TAG} \
--title "Ver. ${TAG}" \
--notes-file ./ja/source/intro/ChangeLog/${TAG:0:4}/${TAG}.rst \
--draft
gh release upload ${TAG} ${GITHUB_WORKSPACE}/freee-a11y-guidelines-${TAG}-html.zip
current:
if: github.repository == 'freee/a11y-guidelines' && github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Extract Branch/Tag Names
run: |
echo "NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.9.x'
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
- name: install ja_JP.UTF-8 locale
run: |
sudo locale-gen ja_JP.UTF-8
sudo update-locale LANG=ja_JP.UTF-8
- name: Install the Latest pip
run: python -m pip install --upgrade pip
- name: Install required modules
run: python -m pip install -r requirements.txt --upgrade
- name: Prepare file upload directory with the archive directory
run: mkdir -p ${GITHUB_WORKSPACE}/upload/current/en
- name: Build HTML with gtag.js, and OGP tags
env:
GTM_ID: ${{ secrets.GTM_ID }}
BASE_URL: https://a11y-guidelines.freee.co.jp/current/
TZ: Asia/Tokyo
run: |
make sphinx_options="-A gtm_id=${GTM_ID} -t current" clean html
cp -r ./data/json/schemas ./ja/build/html
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/current/
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/current/en
- name: Publish to S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete ${GITHUB_WORKSPACE}/upload/current/ s3://${AWS_BUCKET}/current/ --quiet