fix: resolve download failure for albums with special characters, add… #25
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
| name: release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag name (e.g. v2.0.1)" | |
| required: true | |
| default: "v2.0.1" | |
| env: | |
| ARCHIVE_PREFIX: astrbot_plugin_jm_cosmos | |
| jobs: | |
| build-and-release: | |
| name: Publish tagged release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Determine tag | |
| id: prep | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| TAG="${{ github.event.inputs.tag }}" | |
| REF="refs/tags/${TAG}" | |
| else | |
| TAG="${GITHUB_REF_NAME}" | |
| REF="${GITHUB_REF}" | |
| fi | |
| echo "tag_name=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "archive_name=${ARCHIVE_PREFIX}-${TAG}.zip" >> "$GITHUB_OUTPUT" | |
| echo "checkout_ref=${REF}" >> "$GITHUB_OUTPUT" | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ steps.prep.outputs.checkout_ref }} | |
| - name: Build release archive | |
| env: | |
| ARCHIVE_NAME: ${{ steps.prep.outputs.archive_name }} | |
| run: | | |
| # Create temp directory with plugin name | |
| mkdir -p astrbot_plugin_jm_cosmos | |
| # Copy files to temp directory (excluding unwanted files) | |
| rsync -av --exclude='.git' \ | |
| --exclude='.github' \ | |
| --exclude='.venv' \ | |
| --exclude='__pycache__' \ | |
| --exclude='*.pyc' \ | |
| --exclude='.ruff_cache' \ | |
| --exclude='astrbot_plugin_jm_cosmos' \ | |
| . astrbot_plugin_jm_cosmos/ | |
| # Create zip with the directory as root | |
| zip -r "$ARCHIVE_NAME" astrbot_plugin_jm_cosmos | |
| # Cleanup | |
| rm -rf astrbot_plugin_jm_cosmos | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.prep.outputs.tag_name }} | |
| name: JM-Cosmos ${{ steps.prep.outputs.tag_name }} | |
| files: ${{ steps.prep.outputs.archive_name }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |