Release v1.0.0: Initial release of ToniesLoader plugin #1
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: Build and Release Plugin | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| build: | |
| name: Build Plugin Archive | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Get version and plugin info from manifest | |
| id: get_info | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building version: $VERSION" | |
| # Extract plugin name from manifest ID (format: com.author.plugin_name) | |
| PLUGIN_NAME=$(python3 -c "import json; id = json.load(open('manifest.json'))['id']; print(id.split('.')[-1])") | |
| echo "PLUGIN_NAME=$PLUGIN_NAME" >> $GITHUB_OUTPUT | |
| echo "Plugin name: $PLUGIN_NAME" | |
| - name: Verify manifest version | |
| run: | | |
| MANIFEST_VERSION=$(python3 -c "import json; print(json.load(open('manifest.json'))['version'])") | |
| if [ "$MANIFEST_VERSION" != "${{ steps.get_info.outputs.VERSION }}" ]; then | |
| echo "Error: manifest.json version ($MANIFEST_VERSION) does not match tag version (${{ steps.get_info.outputs.VERSION }})" | |
| exit 1 | |
| fi | |
| echo "Version check passed: $MANIFEST_VERSION" | |
| - name: Create plugin archive | |
| id: create_archive | |
| run: | | |
| VERSION="${{ steps.get_info.outputs.VERSION }}" | |
| PLUGIN_NAME="${{ steps.get_info.outputs.PLUGIN_NAME }}" | |
| ARCHIVE_NAME="${PLUGIN_NAME}-${VERSION}.tar.gz" | |
| # Create temporary directory | |
| TEMP_DIR=$(mktemp -d) | |
| PLUGIN_DIR="$TEMP_DIR/$PLUGIN_NAME" | |
| # Copy plugin files | |
| mkdir -p "$PLUGIN_DIR" | |
| cp -r * "$PLUGIN_DIR/" 2>/dev/null || true | |
| # Remove unnecessary files | |
| rm -rf "$PLUGIN_DIR/.git" "$PLUGIN_DIR/.github" | |
| find "$PLUGIN_DIR" -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true | |
| find "$PLUGIN_DIR" -name "*.pyc" -delete 2>/dev/null || true | |
| find "$PLUGIN_DIR" -name ".DS_Store" -delete 2>/dev/null || true | |
| # Create archive | |
| tar -czf "$ARCHIVE_NAME" -C "$TEMP_DIR" "$PLUGIN_NAME" | |
| # Calculate SHA512 checksum | |
| CHECKSUM=$(sha512sum "$ARCHIVE_NAME" | cut -d' ' -f1) | |
| # Get file size | |
| SIZE=$(stat -c%s "$ARCHIVE_NAME") | |
| echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
| echo "CHECKSUM=$CHECKSUM" >> $GITHUB_OUTPUT | |
| echo "SIZE=$SIZE" >> $GITHUB_OUTPUT | |
| # Clean up | |
| rm -rf "$TEMP_DIR" | |
| echo "Created archive: $ARCHIVE_NAME" | |
| echo "SHA512: $CHECKSUM" | |
| echo "Size: $SIZE bytes" | |
| - name: Create manifest with install info | |
| run: | | |
| python3 << 'EOF' | |
| import json | |
| # Load original manifest | |
| with open('manifest.json', 'r') as f: | |
| manifest = json.load(f) | |
| # Add install information | |
| manifest['install'] = { | |
| 'type': 'archive', | |
| 'url': f'https://github.com/${{ github.repository }}/releases/download/v${{ steps.get_info.outputs.VERSION }}/${{ steps.create_archive.outputs.ARCHIVE_NAME }}', | |
| 'checksum': '${{ steps.create_archive.outputs.CHECKSUM }}', | |
| 'checksum_algorithm': 'sha512' | |
| } | |
| # Save release manifest | |
| with open('manifest-release.json', 'w') as f: | |
| json.dump(manifest, f, indent=2) | |
| f.write('\n') | |
| print('Release manifest created') | |
| print(f' Version: ${{ steps.get_info.outputs.VERSION }}') | |
| print(f' Archive: ${{ steps.create_archive.outputs.ARCHIVE_NAME }}') | |
| print(f' Checksum: ${{ steps.create_archive.outputs.CHECKSUM }}...') | |
| EOF | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.get_info.outputs.VERSION }} | |
| name: Release ${{ steps.get_info.outputs.VERSION }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| ${{ steps.create_archive.outputs.ARCHIVE_NAME }} | |
| manifest-release.json | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Summary | |
| run: | | |
| echo "## Release Created! 🎉" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Plugin:** ${{ steps.get_info.outputs.PLUGIN_NAME }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** ${{ steps.get_info.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Archive:** ${{ steps.create_archive.outputs.ARCHIVE_NAME }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Size:** ${{ steps.create_archive.outputs.SIZE }} bytes" >> $GITHUB_STEP_SUMMARY | |
| echo "**SHA512:** \`${{ steps.create_archive.outputs.CHECKSUM }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Release URL: ${{ steps.create_release.outputs.url }}" >> $GITHUB_STEP_SUMMARY |