Update workflow & documentation #106
Workflow file for this run
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
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| name: Release | |
| jobs: | |
| release: | |
| # Note: `github.event.base_ref` is equal to `refs/heads/main` when the workflow is triggered | |
| # by a branch, or a lightweight tag (_not_ an annotated tag), placed on the last commit of the `main` branch | |
| if: github.event.base_ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Checkout LFS objects | |
| run: git lfs checkout | |
| - name: Checkout blender_mmd_assets | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: UuuNyaa/blender_mmd_assets | |
| path: blender_mmd_assets | |
| - name: Build asset | |
| run: | | |
| mkdir mmd_tools_append/asset_jsons | |
| python blender_mmd_assets/cat_asset_json.py UuuNyaa/blender_mmd_assets "{'state': 'open', 'labels':'Official'}" > mmd_tools_append/asset_jsons/assets.json | |
| - name: Copy LICENSE file | |
| run: cp -p LICENSE mmd_tools_append/ | |
| - name: Remove development-only files | |
| run: rm -rf mmd_tools_append/typings | |
| - name: Generate zip filename | |
| run: | | |
| declare -A tag_prefix_to_blender_version=( | |
| ["v1"]="bl3.6" | |
| ["v4"]="bl4.2" | |
| ) | |
| blender_version=${tag_prefix_to_blender_version[${GITHUB_REF_NAME%%.*}]} | |
| if [ -z "$blender_version" ]; then | |
| echo "Error: No Blender version mapping found for tag ${GITHUB_REF_NAME}" | |
| exit 1 | |
| fi | |
| echo "zip_filename=mmd_tools_append-${GITHUB_REF_NAME}-${blender_version}.zip" >> $GITHUB_ENV | |
| - name: Create a zip | |
| run: | | |
| ( | |
| cd mmd_tools_append && | |
| find . -type f ! -path "*/.*" ! -path "*/__pycache__/*" -print | | |
| zip -9r "../${{ env.zip_filename }}" -@ | |
| ) | |
| - name: Create a Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ github.ref_name }} | |
| tag_name: ${{ github.ref_name }} | |
| files: ${{ env.zip_filename }} | |
| draft: true | |
| generate_release_notes: true | |
| prerelease: false |