changed metadata script #12
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
# After pushing a tag (e.g., v1.0.0), GitHub Actions starts | |
# 1. It checks out the code at the commit where the tag was created | |
# 2. Creates the build package using the latest state (with updated metadata) | |
name: Build mpv Script Package | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
- name: Create Package | |
id: create_package | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} | |
DIR_NAME=mpv2anki_v${VERSION} | |
echo "Creating package for version: ${VERSION}" | |
echo "Directory name will be: ${DIR_NAME}" | |
# Create main directory structure | |
mkdir -p build/${DIR_NAME}/mpv/scripts build/${DIR_NAME}/mpv/script-opts | |
echo "Created directory structure" | |
# Copy MPV files with verbose and error checking | |
cp -v mpv/input.conf build/${DIR_NAME}/mpv/ || echo "Warning: input.conf copy failed" | |
cp -v mpv/mpv.conf build/${DIR_NAME}/mpv/ || echo "Warning: mpv.conf copy failed" | |
cp -rv mpv/scripts/mpv2anki build/${DIR_NAME}/mpv/scripts/ || echo "Warning: scripts copy failed" | |
cp -rv mpv/script-opts/* build/${DIR_NAME}/mpv/script-opts/ || echo "Warning: script-opts copy failed" | |
echo "Checking if note_types exists..." | |
mkdir -p build/${DIR_NAME}/note_types | |
if [ -d "docs/note_types/basic" ]; then | |
# Copy note types | |
cp -rv "docs/note_types/basic/Sentence Mining.apkg" build/${DIR_NAME}/note_types/ || echo "Warning: note_types copy failed" | |
else | |
echo "docs/note_types/basic directory not found" | |
fi | |
echo "Creating zip file..." | |
cd build | |
zip -rv ../${DIR_NAME}.zip ${DIR_NAME}/ | |
cd .. | |
ls -la *.zip # Debug: List zip files | |
echo "PACKAGE_PATH=${DIR_NAME}.zip" >> $GITHUB_OUTPUT | |
echo "Build process completed" | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: mpv2anki v${{ steps.get_version.outputs.VERSION }} | |
files: ${{ steps.create_package.outputs.PACKAGE_PATH }} | |
body_path: CHANGELOG.md | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: mpv2anki v${{ steps.get_version.outputs.VERSION }} | |
files: mpv2anki_${{ steps.get_version.outputs.VERSION }}.zip | |
body_path: CHANGELOG.md | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |