diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7d09dc2..f571408 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,5 @@ # Action name -name: Deploy +name: Release # 触发条件,这里是新的 tag 被 push 时触发 on: @@ -85,6 +85,70 @@ jobs: command: build args: --verbose --target ${{ matrix.target }} + # 打包上传二进制文件 + - name: Archive files (debug) + shell: bash + run: | + addon_name="hid" + bin_dir="debug_build/addons/$addon_name/bin" + bin_name="${addon_name}_ext" + + mkdir -p $bin_dir + if [ "${{ matrix.platform }}" = "linux" ]; then + tree target/${{ matrix.target }}/debug/ + + bin_file_debug="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.so" + mv target/${{ matrix.target }}/debug/lib$bin_name.so $bin_dir/$bin_file_debug + + debug_info="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.so.dwp" + mv target/${{ matrix.target }}/debug/lib$bin_name.so.dwp $bin_dir/$debug_info + elif [ "${{ matrix.platform }}" = "macos" ]; then + tree target/${{ matrix.target }}/debug/ + + bin_file_debug="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.dylib" + mv target/${{ matrix.target }}/debug/lib$bin_name.dylib $bin_dir/$bin_file_debug + + debug_info="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.dylib.dSYM" + mv target/${{ matrix.target }}/debug/deps/lib$bin_name.dylib.dSYM $bin_dir/$debug_info + elif [ "${{ matrix.platform }}" = "windows" ]; then + bin_file_debug="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.dll" + mv target/${{ matrix.target }}/debug/$bin_name.dll $bin_dir/$bin_file_debug + + debug_info="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.pdb" + mv target/${{ matrix.target }}/debug/$bin_name.pdb $bin_dir/$debug_info + else + echo "Unsupported platform: ${{ matrix.platform }}" + fi + + cat>$bin_dir/../$addon_name.gdextension<> $GITHUB_ENV + else + tree addons + tar -czvf "../$archive_name.tar.gz" "addons" + echo "ASSET_DEBUG=$archive_name.tar.gz" >> $GITHUB_ENV + fi + + - name: Release files (debug) + uses: softprops/action-gh-release@v1 + with: + files: | + ${{ env.ASSET_DEBUG }} + + # 构建二进制文件 - name: Build binary files (release) uses: actions-rs/cargo@v1 with: @@ -93,32 +157,22 @@ jobs: args: --verbose --release --target ${{ matrix.target }} # 打包上传二进制文件 - - name: Archive files + - name: Archive files (release) shell: bash run: | addon_name="hid" - bin_dir="addons/$addon_name/bin" + bin_dir="release_build/addons/$addon_name/bin" bin_name="${addon_name}_ext" mkdir -p $bin_dir - if [ "${{ matrix.platform }}" = "linux" ]; then - bin_file_debug="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.so" bin_file_release="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.release.so" - - mv target/${{ matrix.target }}/debug/lib$bin_name.so $bin_dir/$bin_file_debug mv target/${{ matrix.target }}/release/lib$bin_name.so $bin_dir/$bin_file_release elif [ "${{ matrix.platform }}" = "macos" ]; then - bin_file_debug="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.dylib" bin_file_release="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.release.dylib" - - mv target/${{ matrix.target }}/debug/lib$bin_name.dylib $bin_dir/$bin_file_debug mv target/${{ matrix.target }}/release/lib$bin_name.dylib $bin_dir/$bin_file_release elif [ "${{ matrix.platform }}" = "windows" ]; then - bin_file_debug="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.debug.dll" bin_file_release="lib$bin_name.${{ matrix.platform }}.${{ matrix.arch }}.release.dll" - - mv target/${{ matrix.target }}/debug/$bin_name.dll $bin_dir/$bin_file_debug mv target/${{ matrix.target }}/release/$bin_name.dll $bin_dir/$bin_file_release else echo "Unsupported platform: ${{ matrix.platform }}" @@ -130,23 +184,24 @@ jobs: compatibility_minimum = 4.1 [libraries] - ${{ matrix.platform }}.debug.${{ matrix.arch }} = "bin/$bin_file_debug" ${{ matrix.platform }}.release.${{ matrix.arch }} = "bin/$bin_file_release" EOF - archive_name="$addon_name-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}" + archive_name="$addon_name-${{ env.VERSION }}-${{ matrix.platform }}-release-${{ matrix.arch }}" + + cd release_build if [ "${{ matrix.platform }}" = "windows" ]; then - 7z a "$archive_name.zip" "addons" - echo "ASSET=$archive_name.zip" >> $GITHUB_ENV + 7z a "../$archive_name.zip" "addons" + echo "ASSET_RELEASE=$archive_name.zip" >> $GITHUB_ENV else tree addons - tar -czvf "$archive_name.tar.gz" "addons" - echo "ASSET=$archive_name.tar.gz" >> $GITHUB_ENV + tar -czvf "../$archive_name.tar.gz" "addons" + echo "ASSET_RELEASE=$archive_name.tar.gz" >> $GITHUB_ENV fi - - name: Release files + - name: Release files (release) uses: softprops/action-gh-release@v1 with: files: | - ${{ env.ASSET }} \ No newline at end of file + ${{ env.ASSET_RELEASE }} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 435fb22..2ce3eba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hid" -version = "0.0.2" +version = "0.0.3" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -12,3 +12,6 @@ crate-type = ["cdylib"] [dependencies] hidapi = "2.4.1" godot = { git = "https://github.com/godot-rust/gdext", branch = "master" } + +[profile.dev] +split-debuginfo = "packed"