diff --git a/.SourceSageignore b/.SourceSageignore new file mode 100644 index 0000000..0d864aa --- /dev/null +++ b/.SourceSageignore @@ -0,0 +1,67 @@ +.git +__pycache__ +LICENSE +output.md +assets +Style-Bert-VITS2 +output +streamlit +SourceSage.md +data +.gitignore +.SourceSageignore +*.png +Changelog +SourceSageAssets +SourceSageAssetsDemo +__pycache__ +.pyc +**/__pycache__/** +modules\__pycache__ +.svg +sourcesage.egg-info +.pytest_cache +dist +build +.env +example + +.gaiah.md +.Gaiah.md +tmp.md +tmp2.md +.SourceSageAssets +tests +template +aira.egg-info +aira.Gaiah.md +README_template.md + +egg-info +oasis_article.egg-info +.harmon_ai +.aira + +article_draft +issue_creator.log +oasis.log + +debug_output +*.log + +html_replacement1.html +html_raw.html +html_content.html +html_with_placeholders.html +markdown_html.html +markdown_text.md +markdown_text2.md + +saved_article.html +memo.md +content.md + +.SourceSageAssets +docs +.github +.venv diff --git a/.github/github_add_collaborator.py b/.github/setup/github_add_collaborator.py similarity index 100% rename from .github/github_add_collaborator.py rename to .github/setup/github_add_collaborator.py diff --git a/.github/setup/update_repo_name.py b/.github/setup/update_repo_name.py new file mode 100644 index 0000000..d164cff --- /dev/null +++ b/.github/setup/update_repo_name.py @@ -0,0 +1,48 @@ +import os +import sys +from loguru import logger + +def update_files(new_repo_name): + logger.info(f"リポジトリ名を '{new_repo_name}' に更新します") + + files_to_update = [ + '.github/workflows/publish-to-pypi.yml', + '.github/workflows/sync-to-huggingface.yml', + '.github/release_notes/.sourcesage_releasenotes_iris.yml' + ] + + for file_path in files_to_update: + full_path = os.path.join(os.getcwd(), file_path) + if not os.path.exists(full_path): + logger.warning(f"ファイル {full_path} が見つかりません。スキップします。") + continue + + logger.info(f"{file_path} の処理を開始します") + + with open(full_path, 'r', encoding='utf-8') as file: + content = file.read() + + updated_content = content.replace('HarmonAI_III', new_repo_name) + + if content != updated_content: + with open(full_path, 'w', encoding='utf-8') as file: + file.write(updated_content) + logger.success(f"{file_path} を更新しました") + else: + logger.info(f"{file_path} には変更が必要ありませんでした") + +if __name__ == "__main__": + + if len(sys.argv) != 2: + logger.error("使用方法: python update_repo_name.py <新しいリポジトリ名>") + sys.exit(1) + + new_repo_name = sys.argv[1] + logger.info(f"スクリプトを開始します。新しいリポジトリ名: {new_repo_name}") + + try: + update_files(new_repo_name) + logger.success("リポジトリ名の更新が完了しました") + except Exception as e: + logger.exception(f"更新処理中にエラーが発生しました: {str(e)}") + sys.exit(1) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..c8eaf27 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,30 @@ +name: Publish Python Package + +on: + push: + tags: + - '*' +jobs: + publish: + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/HarmonAI_III + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true diff --git a/.github/workflows/sync-to-huggingface.yml b/.github/workflows/sync-to-huggingface.yml new file mode 100644 index 0000000..fc1b7b0 --- /dev/null +++ b/.github/workflows/sync-to-huggingface.yml @@ -0,0 +1,29 @@ +name: Sync to Hugging Face hub +on: + push: + branches: [main] + + # to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + sync-to-hub: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Configure Git + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + - name: Remove .github and PNG files from history + run: | + git filter-branch --force --index-filter \ + 'git rm -rf --cached --ignore-unmatch .github *.png' \ + --prune-empty --tag-name-filter cat -- --all + - name: Push to Hugging Face hub + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + run: | + git push -f https://MakiAi:$HF_TOKEN@huggingface.co/spaces/MakiAi/HarmonAI_III main