セットアップを全面的にuvへ切り替え #219
Workflow file for this run
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: sphinxjp/sphinx-users.jp | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # to get full commit logs for 'git-set-file-times' | |
- name: DEBUG INFO github refs | |
run: | | |
echo ${{ github.ref }} | |
echo ${{ github.head_ref }} | |
echo ${{ github.base_ref }} | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
echo "yyyymm=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: git-set-file-times | |
# change timestamps with commit time instead of checkout time. | |
run: | | |
chmod +x ./.github/git-set-file-times.py | |
./.github/git-set-file-times.py | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "latest" | |
enable-cache: true | |
- name: CACHE sphinx build | |
id: cache-sphinx-build | |
uses: actions/cache@v4 | |
with: | |
path: build | |
key: ${{ runner.os }}-sphinx-build-${{ github.ref }}-${{ steps.get-date.outputs.date }} | |
- name: install packages | |
run: | | |
echo "python version $(uv run python --version) running" | |
echo "uv version $(uv --version) running" | |
uv sync | |
uv run python -m site | |
uv pip freeze | |
- name: build html | |
run: | | |
echo "sphinx-build version $(uv run sphinx-build --version) running" | |
uv run sphinx-build -M html source build -N -T | |
- name: s3sync | |
run: | | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip -q awscliv2.zip | |
sudo ./aws/install --update | |
aws --version | |
# https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/sync.html | |
aws s3 sync ${SOURCE_DIR} s3://${AWS_S3_BUCKET}/${DEST_PATH} --acl public-read --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "ap-northeast-1" | |
SOURCE_DIR: "build/html" | |
DEST_PATH: "" | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: slack-notifier | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: workflow | |
author_name: Deploy contents to S3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: ${{ github.ref == 'refs/heads/master' }} |