diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4ac4ed8..0633303 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -2,7 +2,9 @@ name: Create Release on: push: - branches: [main] + branches: + - main + - master jobs: create-release: @@ -10,44 +12,70 @@ jobs: permissions: contents: write steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Determine plugin bundle + id: get_plugin + run: | + PLUGIN_BUNDLE_PATH=$(find . -maxdepth 1 -iname "*.indigoPlugin" -type d | head -1) + if [ -z "$PLUGIN_BUNDLE_PATH" ]; then + echo "Error: No .indigoPlugin directory found in repository root." >&2 + exit 1 + fi + PLUGIN_BUNDLE=$(basename "$PLUGIN_BUNDLE_PATH") + echo "plugin_bundle=$PLUGIN_BUNDLE" >> $GITHUB_OUTPUT + echo "Detected plugin bundle: $PLUGIN_BUNDLE" + - name: Extract version from Info.plist id: get_version run: | - VERSION=$(grep -A1 'PluginVersion' "Netro Sprinklers.indigoPlugin/Contents/Info.plist" | grep '' | sed 's/.*\(.*\)<\/string>.*/\1/') + PLUGIN_BUNDLE="${{ steps.get_plugin.outputs.plugin_bundle }}" + VERSION=$(grep -A1 'PluginVersion' "${PLUGIN_BUNDLE}/Contents/Info.plist" | grep '' | sed 's/.*\(.*\)<\/string>.*/\1/') + if [ -z "$VERSION" ]; then + echo "Error: Could not extract PluginVersion from Info.plist." >&2 + exit 1 + fi echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Found version: $VERSION" + echo "Extracted version: $VERSION" - - name: Check if tag already exists - id: check_tag + - name: Check if release already exists + id: check_release run: | VERSION="${{ steps.get_version.outputs.version }}" - if git tag -l | grep -q "^${VERSION}$"; then + if git rev-parse "v$VERSION" >/dev/null 2>&1; then echo "exists=true" >> $GITHUB_OUTPUT - echo "Tag ${VERSION} already exists, skipping release creation" + echo "Release v$VERSION already exists, skipping." else echo "exists=false" >> $GITHUB_OUTPUT - echo "Tag ${VERSION} does not exist, will create release" + echo "Release v$VERSION does not exist, will create." fi - name: Create plugin bundle zip - if: steps.check_tag.outputs.exists == 'false' + if: steps.check_release.outputs.exists == 'false' run: | - VERSION="${{ steps.get_version.outputs.version }}" - zip -r "Netro Sprinklers.indigoPlugin.zip" "Netro Sprinklers.indigoPlugin" - echo "Created Netro Sprinklers.indigoPlugin.zip" + PLUGIN_BUNDLE="${{ steps.get_plugin.outputs.plugin_bundle }}" + zip -r "${PLUGIN_BUNDLE}.zip" "${PLUGIN_BUNDLE}" \ + -x "*.pyc" \ + -x "*/__pycache__" \ + -x "*/__pycache__/*" \ + -x "*.sublime-project" \ + -x "*.sublime-workspace" \ + -x "*/.idea" \ + -x "*/.idea/*" \ + -x "*.bbproject" \ + -x "*.bbproject/*" + echo "Created ${PLUGIN_BUNDLE}.zip" - - name: Create Release - if: steps.check_tag.outputs.exists == 'false' - uses: softprops/action-gh-release@v1 + - name: Create GitHub Release + if: steps.check_release.outputs.exists == 'false' + uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.get_version.outputs.version }} - name: Release ${{ steps.get_version.outputs.version }} + tag_name: v${{ steps.get_version.outputs.version }} + name: Release v${{ steps.get_version.outputs.version }} generate_release_notes: true - files: Netro Sprinklers.indigoPlugin.zip - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + draft: false + prerelease: false + files: ${{ steps.get_plugin.outputs.plugin_bundle }}.zip diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index 35e63d0..7e8d7cd 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -2,29 +2,52 @@ name: Version Check on: pull_request: - branches: [master, main] + branches: + - main + - master jobs: check-version: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Determine plugin bundle + id: get_plugin + run: | + PLUGIN_BUNDLE_PATH=$(find . -maxdepth 1 -iname "*.indigoPlugin" -type d | head -1) + if [ -z "$PLUGIN_BUNDLE_PATH" ]; then + echo "Error: No .indigoPlugin directory found in repository root." >&2 + exit 1 + fi + PLUGIN_BUNDLE=$(basename "$PLUGIN_BUNDLE_PATH") + echo "plugin_bundle=$PLUGIN_BUNDLE" >> $GITHUB_OUTPUT + echo "Detected plugin bundle: $PLUGIN_BUNDLE" + - name: Extract version from Info.plist id: get_version run: | - VERSION=$(grep -A1 'PluginVersion' "Netro Sprinklers.indigoPlugin/Contents/Info.plist" | grep '' | sed 's/.*\(.*\)<\/string>.*/\1/') + PLUGIN_BUNDLE="${{ steps.get_plugin.outputs.plugin_bundle }}" + VERSION=$(grep -A1 'PluginVersion' "${PLUGIN_BUNDLE}/Contents/Info.plist" | grep '' | sed 's/.*\(.*\)<\/string>.*/\1/') + if [ -z "$VERSION" ]; then + echo "Error: Could not extract PluginVersion from Info.plist." >&2 + exit 1 + fi echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Found version: $VERSION" + echo "Extracted version: $VERSION" - - name: Check if version tag already exists + - name: Check if tag already exists run: | VERSION="${{ steps.get_version.outputs.version }}" - if git tag -l | grep -q "^${VERSION}$"; then - echo "::error::Version ${VERSION} already exists as a tag. Please update the version in Info.plist." + if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "::error::Version v$VERSION already exists as a git tag. Please update the PluginVersion in Info.plist." + exit 1 + fi + if git rev-parse "$VERSION" >/dev/null 2>&1; then + echo "::error::Version $VERSION already exists as a git tag. Please update the PluginVersion in Info.plist." exit 1 fi - echo "Version ${VERSION} is unique - check passed" + echo "✓ Version $VERSION is new and can be released." diff --git a/Netro Sprinklers.indigoPlugin/Contents/Info.plist b/Netro Sprinklers.indigoPlugin/Contents/Info.plist index 08b52d5..de6c0a8 100644 --- a/Netro Sprinklers.indigoPlugin/Contents/Info.plist +++ b/Netro Sprinklers.indigoPlugin/Contents/Info.plist @@ -3,7 +3,7 @@ PluginVersion - 2026.5.3 + 2026.5.5 ServerApiVersion 3.6 IwsApiVersion