docs: add Japanese documentation #889
This file contains hidden or 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: Build Docker | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - closed | |
| branches: | |
| - main | |
| push: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Install dependencies | |
| run: cd backend && uv sync --group dev | |
| - name: Test | |
| run: | | |
| mkdir -p backend/config | |
| cd backend && uv run pytest src/test -v | |
| webui-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: cd webui && pnpm install | |
| - name: build test | |
| run: | | |
| cd webui && pnpm test:build | |
| version-info: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: If release | |
| id: release | |
| run: | | |
| if [[ '${{ github.event_name }}' == 'pull_request' && '${{ github.event.pull_request.head.ref }}' == *'dev'* ]]; then | |
| if [ ${{ github.event.pull_request.merged }} == true ]; then | |
| echo "release=1" >> $GITHUB_OUTPUT | |
| else | |
| echo "release=0" >> $GITHUB_OUTPUT | |
| fi | |
| elif [[ '${{ github.event_name }}' == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then | |
| echo "release=1" >> $GITHUB_OUTPUT | |
| else | |
| echo "release=0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: If dev | |
| id: dev | |
| run: | | |
| if [[ '${{ github.event_name }}' == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then | |
| echo "dev=1" >> $GITHUB_OUTPUT | |
| else | |
| echo "dev=0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check version | |
| id: version | |
| run: | | |
| if [ '${{ github.event_name }}' == 'pull_request' ]; then | |
| if [ ${{ github.event.pull_request.merged }} == true ]; then | |
| # Extract version from PR title (handles "Release X.Y.Z", "vX.Y.Z", or "X.Y.Z") | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' | head -1) | |
| if [ -n "$VERSION" ]; then | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=$PR_TITLE" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| elif [[ ${{ github.event_name }} == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then | |
| echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=Test" >> $GITHUB_OUTPUT | |
| fi | |
| - name: If build test | |
| id: build_test | |
| run: | | |
| if [[ '${{ github.event_name }}' == 'pull_request' && '${{ github.event.pull_request.merged }}' != 'true' && '${{ github.event.pull_request.head.ref }}' == *'dev'* ]]; then | |
| echo "build_test=1" >> $GITHUB_OUTPUT | |
| else | |
| echo "build_test=0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check result | |
| run: | | |
| echo "release: ${{ steps.release.outputs.release }}" | |
| echo "dev: ${{ steps.dev.outputs.dev }}" | |
| echo "build_test: ${{ steps.build_test.outputs.build_test }}" | |
| echo "version: ${{ steps.version.outputs.version }}" | |
| outputs: | |
| release: ${{ steps.release.outputs.release }} | |
| dev: ${{ steps.dev.outputs.dev }} | |
| build_test: ${{ steps.build_test.outputs.build_test }} | |
| version: ${{ steps.version.outputs.version }} | |
| build-webui: | |
| runs-on: ubuntu-latest | |
| needs: [test, webui-test, version-info] | |
| if: ${{ needs.version-info.outputs.release == 1 || needs.version-info.outputs.dev == 1 || needs.version-info.outputs.build_test == 1 }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: cd webui && pnpm install | |
| - name: Build | |
| run: | | |
| cd webui && pnpm build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: webui/dist | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| needs: [build-webui, version-info] | |
| if: ${{ needs.version-info.outputs.release == 1 || needs.version-info.outputs.dev == 1 || needs.version-info.outputs.build_test == 1 }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Create Version info via tag | |
| working-directory: ./backend/src | |
| run: | | |
| echo ${{ needs.version-info.outputs.version }} | |
| echo "VERSION='${{ needs.version-info.outputs.version }}'" >> module/__version__.py | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Docker metadata main | |
| if: ${{ needs.version-info.outputs.release == 1 && needs.version-info.outputs.dev != 1 }} | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: | | |
| estrellaxd/auto_bangumi | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=${{ needs.version-info.outputs.version }} | |
| type=raw,value=latest | |
| - name: Docker metadata dev | |
| if: ${{ needs.version-info.outputs.dev == 1 }} | |
| id: meta-dev | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: | | |
| estrellaxd/auto_bangumi | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=${{ needs.version-info.outputs.version }} | |
| type=raw,value=dev-latest | |
| - name: Login to DockerHub | |
| if: ${{ needs.version-info.outputs.release == 1 }} | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Login to ghcr.io | |
| if: ${{ needs.version-info.outputs.release == 1 }} | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.ACCESS_TOKEN }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: backend/src/dist | |
| - name: Build and push | |
| if: ${{ needs.version-info.outputs.release == 1 && needs.version-info.outputs.dev != 1 }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| builder: ${{ steps.buildx.output.name }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: True | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha, scope=${{ github.workflow }} | |
| cache-to: type=gha, scope=${{ github.workflow }} | |
| - name: Build and push dev | |
| if: ${{ needs.version-info.outputs.dev == 1 }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| builder: ${{ steps.buildx.output.name }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta-dev.outputs.tags }} | |
| labels: ${{ steps.meta-dev.outputs.labels }} | |
| cache-from: type=gha, scope=${{ github.workflow }} | |
| cache-to: type=gha, scope=${{ github.workflow }} | |
| - name: Build test | |
| if: ${{ needs.version-info.outputs.release == 0 }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| builder: ${{ steps.buildx.output.name }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: false | |
| tags: estrellaxd/auto_bangumi:test | |
| cache-from: type=gha, scope=${{ github.workflow }} | |
| cache-to: type=gha, scope=${{ github.workflow }} | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-docker, version-info] | |
| if: ${{ needs.version-info.outputs.release == 1 }} | |
| outputs: | |
| url: ${{ steps.release.outputs.url }} | |
| version: ${{ needs.version-info.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download artifact webui | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: webui/dist | |
| - name: Zip webui | |
| run: | | |
| cd webui && ls -al && tree && zip -r dist.zip dist | |
| - name: Download artifact app | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: backend/src/dist | |
| - name: Create Version info via tag | |
| working-directory: ./backend/src | |
| run: | | |
| echo ${{ needs.version-info.outputs.version }} | |
| echo "VERSION='${{ needs.version-info.outputs.version }}'" >> module/__version__.py | |
| - name: Zip app | |
| run: | | |
| cd backend && zip -r app-v${{ needs.version-info.outputs.version }}.zip src | |
| - name: Generate Release info | |
| id: release-info | |
| run: | | |
| if ${{ needs.version-info.outputs.dev == 1 }}; then | |
| echo "version=🌙${{ needs.version-info.outputs.version }}" >> $GITHUB_OUTPUT | |
| echo "pre_release=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=🌟${{ needs.version-info.outputs.version }}" >> $GITHUB_OUTPUT | |
| echo "pre_release=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Read changelog | |
| id: changelog | |
| run: | | |
| if [ -f docs/changelog/3.2.md ]; then | |
| echo "body<<EOF" >> $GITHUB_OUTPUT | |
| cat docs/changelog/3.2.md >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Release | |
| id: release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.version-info.outputs.version }} | |
| name: ${{ steps.release-info.outputs.version }} | |
| body: ${{ github.event.pull_request.body || steps.changelog.outputs.body }} | |
| draft: false | |
| prerelease: ${{ steps.release-info.outputs.pre_release == 'true' }} | |
| files: | | |
| webui/dist.zip | |
| backend/app-v${{ needs.version-info.outputs.version }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
| telegram: | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| steps: | |
| - name: send telegram message on push | |
| uses: appleboy/telegram-action@master | |
| with: | |
| to: ${{ secrets.TELEGRAM_TO }} | |
| token: ${{ secrets.TELEGRAM_TOKEN }} | |
| message: | | |
| New release: ${{ needs.release.outputs.version }} | |
| Link: ${{ needs.release.outputs.url }} |