Skip to content

Commit

Permalink
[更新CI/CD流程和包重命名脚本]: 更新了GitHub Actions工作流,增加了包重命名的shell脚本,以自动化发布流程。
Browse files Browse the repository at this point in the history
- 更新了`cmake.yml`工作流,移除了下载字体的步骤,改为检出代码和下载构建产物。
- 新增了`rename_package.sh`脚本来重命名打包的文件,使其包含标签名,以便于识别。
- 修改了`cmake.yml`工作流,调用`rename_package.sh`脚本来重命名包。
- 移除了`cmake.yml`中根据标签重命名文件的步骤,因为现在由`rename_package.sh`脚本处理。
- 在`rename_package.sh`脚本中,下载了旧版本的字体文件。
  • Loading branch information
RealChuan committed May 23, 2024
1 parent add9c79 commit 017f117
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 26 deletions.
38 changes: 12 additions & 26 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -187,4 +173,4 @@ jobs:
prerelease: false
generate_release_notes: true
files: |
*.7z
${{ env.RELEASES_DIR }}/*
46 changes: 46 additions & 0 deletions packaging/rename_packages.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 017f117

Please sign in to comment.