diff --git a/.github/workflows/compress.yml b/.github/workflows/compress.yml index 741ae55..a335802 100644 --- a/.github/workflows/compress.yml +++ b/.github/workflows/compress.yml @@ -6,7 +6,7 @@ on: - main # Ignore the push event if commit message contains "[skip ci]" paths-ignore: - - 'src/appcast.json' + - 'appcast.json' jobs: zip: @@ -28,7 +28,8 @@ jobs: - name: Zip src directory run: | - zip -r src.zip src + cd src && zip -r src.zip . -x ".*" -x "*/.*" -x "*/*/.*" -x "*/*/*/.*" -x "src.zip" + mv src.zip ../ working-directory: ${{ github.workspace }} - name: Calculate SHA256 @@ -39,13 +40,13 @@ jobs: - name: Read appcast.json id: read_appcast run: | - echo ::set-output name=appcast::$(cat src/appcast.json) + echo ::set-output name=appcast::$(cat appcast.json) working-directory: ${{ github.workspace }} - name: Determine next version id: next_version run: | - versions=$(jq '.versions[].version' src/appcast.json) + versions=$(jq '.versions[].version' appcast.json) if [ -z "$versions" ]; then versions="0.0.0" fi @@ -72,6 +73,15 @@ jobs: echo "::set-output name=next_version::$new_version" shell: bash working-directory: ${{ github.workspace }} + + - name: Get Info.json Version + id: get_info_version + run: | + version=$(jq -r '.version' src/info.json) + echo "Version: $version" + echo "::set-output name=version::$version" + shell: bash + working-directory: ${{ github.workspace }} - name: Get commit message id: commit_message @@ -99,13 +109,18 @@ jobs: }' # Read the current appcast.json - current_appcast=$(cat src/appcast.json) + current_appcast=$(cat appcast.json) # Append the new version object to the versions array new_appcast=$(jq --argjson new_version "$new_version" '.versions += [$new_version]' <<< "$current_appcast") # Update appcast.json with the new versions array - echo "$new_appcast" > src/appcast.json + echo "$new_appcast" > appcast.json + working-directory: ${{ github.workspace }} + + - name: Modify src/info.json + run: | + jq --arg new_version "${{ steps.next_version.outputs.next_version }}" '.version = $new_version' src/info.json > tmp.$$.json && mv tmp.$$.json src/info.json working-directory: ${{ github.workspace }} - name: Create Release @@ -114,7 +129,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} with: - tag_name: v${{ github.run_number }} + tag_name: ${{ steps.next_version.outputs.next_version }} release_name: ${{ steps.build.outputs.build }}.bobplugin ${{ steps.next_version.outputs.next_version }} body: | - Added ${{ steps.build.outputs.build }}.bobplugin diff --git a/bob-plugin-deeplx-translator.bobplugin b/bob-plugin-deeplx-translator.bobplugin deleted file mode 100644 index a4acdea..0000000 Binary files a/bob-plugin-deeplx-translator.bobplugin and /dev/null differ diff --git a/src/info.json b/src/info.json index 05e4aad..f92b689 100644 --- a/src/info.json +++ b/src/info.json @@ -1,58 +1,58 @@ { - "identifier": "yantao.deeplx.bob", - "version": "0.1.1", - "category": "translate", - "name": "DeepLx 翻译插件", - "summary": "DeepLx 翻译插件", - "icon": "115", - "author": "yantao", - "homepage": "https://yantao.wiki", - "appcast": "https://raw.githubusercontent.com/almightyYantao/bob-plugin-deeplx-translator/main/appcast.json", - "minBobVersion": "0.5.0", - "options": [ + "identifier": "yantao.deeplx.bob", + "version": "0.0.2", + "category": "translate", + "name": "DeepLx 翻译插件", + "summary": "DeepLx 翻译插件", + "icon": "115", + "author": "yantao", + "homepage": "https://yantao.wiki", + "appcast": "https://raw.githubusercontent.com/almightyYantao/bob-plugin-deeplx-translator/main/appcast.json", + "minBobVersion": "0.5.0", + "options": [ + { + "identifier": "key", + "type": "text", + "desc": "申请地址:https://linux.do/t/topic/111737", + "title": "Key" + }, + { + "identifier": "apiMenu", + "type": "menu", + "title": "API类型", + "defaultValue": "1", + "menuValues": [ { - "identifier": "key", - "type": "text", - "desc": "申请地址:https://linux.do/t/topic/111737", - "title": "Key" + "title": "内置API-Linux.Do", + "value": "1" }, { - "identifier": "apiMenu", - "type": "menu", - "title": "API类型", - "defaultValue": "1", - "menuValues": [ - { - "title": "内置API-Linux.Do", - "value": "1" - }, - { - "title": "自定义API", - "value": "2" - } - ] - }, + "title": "自定义API", + "value": "2" + } + ] + }, + { + "identifier": "customUrl", + "type": "text", + "title": "自定义API地址", + "desc": "请填写完成的地址:https://api.deeplx.org/key/translate\n需要带上Key,否则的话将失效" + }, + { + "identifier": "alternatives", + "type": "menu", + "title": "是否启用Alternatives", + "defaultValue": "1", + "menuValues": [ { - "identifier": "customUrl", - "type": "text", - "title": "自定义API地址", - "desc": "请填写完成的地址:https://api.deeplx.org/key/translate\n需要带上Key,否则的话将失效" + "title": "启用", + "value": "1" }, { - "identifier": "alternatives", - "type": "menu", - "title": "是否启用Alternatives", - "defaultValue": "1", - "menuValues": [ - { - "title": "启用", - "value": "1" - }, - { - "title": "禁用", - "value": "2" - } - ] + "title": "禁用", + "value": "2" } - ] -} \ No newline at end of file + ] + } + ] +}