-
Notifications
You must be signed in to change notification settings - Fork 16
77 lines (77 loc) · 2.75 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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' }}