Merge pull request #134 from ma10/release-202311.0 #68
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: 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 | |
- 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 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 | |
- 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 }} | |
BASE_URL: https://a11y-guidelines.freee.co.jp/ | |
run: | | |
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL}" clean html | |
cp -r ./data/json/schemas ./build/html | |
cp -r ./build/html/* ${GITHUB_WORKSPACE}/upload | |
make clean | |
current_commit=$(git rev-parse HEAD) | |
for _tag in `git tag` ; do \ | |
echo "Processing ${_tag}..." ; \ | |
if [ ! -d ${GITHUB_WORKSPACE}/upload/archive/${_tag} ] ; then \ | |
git checkout ${_tag} ; \ | |
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL}/${_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} ; \ | |
make clean ; \ | |
git checkout ${current_commit} ; \ | |
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 | |
run: | | |
make clean html | |
cp -r ./data/json/schemas ./build/html | |
mv ./build/html ./freee-a11y-guidelines-${TAG} | |
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 ./soruce/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 | |
- 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 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 | |
- name: Download the existing archive files from S3 | |
env: | |
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
run: aws s3 sync --delete s3://${AWS_BUCKET}/current/ ${GITHUB_WORKSPACE}/upload/current/ --quiet | |
- name: Build HTML with gtag.js, and OGP tags | |
env: | |
GTM_ID: ${{ secrets.GTM_ID }} | |
BASE_URL: https://a11y-guidelines.freee.co.jp/current/ | |
run: | | |
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=${BASE_URL} -t current" clean html | |
cp -r ./data/json/schemas ./build/html | |
cp -r ./build/html/* ${GITHUB_WORKSPACE}/upload/current/ | |
- 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 |