From 017f11749f463de5f732dd3b597ebeb075fa5192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=AE=E7=94=9F=E8=8B=A5=E6=A2=A6?= <1070753498@qq.com> Date: Thu, 23 May 2024 13:20:31 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0CI/CD=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=92=8C=E5=8C=85=E9=87=8D=E5=91=BD=E5=90=8D=E8=84=9A=E6=9C=AC?= =?UTF-8?q?]:=20=E6=9B=B4=E6=96=B0=E4=BA=86GitHub=20Actions=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=8C=85?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E7=9A=84shell=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E8=87=AA=E5=8A=A8=E5=8C=96=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新了`cmake.yml`工作流,移除了下载字体的步骤,改为检出代码和下载构建产物。 - 新增了`rename_package.sh`脚本来重命名打包的文件,使其包含标签名,以便于识别。 - 修改了`cmake.yml`工作流,调用`rename_package.sh`脚本来重命名包。 - 移除了`cmake.yml`中根据标签重命名文件的步骤,因为现在由`rename_package.sh`脚本处理。 - 在`rename_package.sh`脚本中,下载了旧版本的字体文件。 --- .github/workflows/cmake.yml | 38 ++++++++++------------------- packaging/rename_packages.sh | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 26 deletions(-) create mode 100644 packaging/rename_packages.sh diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 02b3d88..2da66f9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -145,40 +145,26 @@ jobs: runs-on: ubuntu-latest steps: - - name: Download fonts + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Mkdir releases shell: bash run: | - wget -c -nv "https://github.com/RealChuan/Qt-App/releases/download/0.0.1/fonts.7z" + mkdir -p ${{ env.RELEASES_DIR }} - name: Download packages uses: actions/download-artifact@v4 + with: + path: ${{ env.RELEASES_DIR }} - name: Move packages + working-directory: packaging shell: bash run: | - ls -al - mv ./windows*/*.7z . - mv ./ubuntu*/*.7z . - mv ./macos*/*.7z . - ls -al - - - name: Rename Files According to Tag - shell: bash - run: | - TAG_NAME="${GITHUB_REF#refs/tags/}" - - for FILE in Qt-App_*.7z; do - if [[ -f "$FILE" ]]; then - BASENAME=$(basename "$FILE" .7z) - REST="${BASENAME#Qt-App_}" - NEW_BASENAME="Qt-App_${TAG_NAME}_${REST}" - NEW_FILE="${NEW_BASENAME}.7z" - mv "$FILE" "$NEW_FILE" - echo "Renamed $FILE to $NEW_FILE" - fi - done - - ls -al + sudo chmod +x rename_packages.sh + ./rename_packages.sh - name: Create release uses: softprops/action-gh-release@v2 @@ -187,4 +173,4 @@ jobs: prerelease: false generate_release_notes: true files: | - *.7z + ${{ env.RELEASES_DIR }}/* diff --git a/packaging/rename_packages.sh b/packaging/rename_packages.sh new file mode 100644 index 0000000..96a4faf --- /dev/null +++ b/packaging/rename_packages.sh @@ -0,0 +1,46 @@ +#!/bin/bash -ex + +cd "$(dirname "$0")" +cd .. +project_dir="$(pwd)" +echo "Current directory: ${project_dir}" + +releases_dir="${project_dir}/packaging/releases" +TAG_NAME="${GITHUB_REF#refs/tags/}" + +cd ${releases_dir} +ls -al + +cd windows* +mv *.7z Qt-App_${TAG_NAME}_windows_x86_64.7z +mv *.exe Qt-App_${TAG_NAME}_x86_64.exe +mv * ${releases_dir}/ +cd .. + +cd ubuntu* +mv *.7z Qt-App_${TAG_NAME}_ubuntu_x86_64.7z +mv *.AppImage Qt-App_${TAG_NAME}_x86_64.AppImage +mv *.deb Qt-App_${TAG_NAME}_x86_64.deb +mv * ${releases_dir}/ +cd .. + +cd macos*x86* +mv *.7z Qt-App_${TAG_NAME}_macos_x86_64.7z +mv *.dmg Qt-App_${TAG_NAME}_x86_64.dmg +mv *.pkg Qt-App_${TAG_NAME}_x86_64.pkg +mv * ${releases_dir}/ +cd .. + +cd macos*arm* +mv *.7z Qt-App_${TAG_NAME}_macos_aarch64.7z +mv *.dmg Qt-App_${TAG_NAME}_aarch64.dmg +mv *.pkg Qt-App_${TAG_NAME}_aarch64.pkg +mv * ${releases_dir}/ +cd .. + +cd ${releases_dir} +wget -nv "https://github.com/RealChuan/Qt-App/releases/download/0.0.1/fonts.7z" + +ls -al + +exit 0