From f258a45ca3983f97a15281ec64f32531c4d4702b Mon Sep 17 00:00:00 2001 From: sqzw-x Date: Fri, 19 Jan 2024 17:18:50 +0800 Subject: [PATCH] CI: release notes --- .github/workflows/release.yml | 108 +++++++++++++++++++--------------- build-conda.ps1 | 40 ------------- build.ps1 | 24 -------- build.sh | 24 ++++++++ changelog.md | 24 ++++++++ changelog.ps1 | 2 - changelog.sh | 15 +++++ 7 files changed, 123 insertions(+), 114 deletions(-) delete mode 100644 build-conda.ps1 delete mode 100644 build.ps1 create mode 100644 build.sh create mode 100644 changelog.md delete mode 100644 changelog.ps1 create mode 100644 changelog.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8448128..a9cddb5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,48 +53,48 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_VERSION }} - cache: pip - - - name: Install libraries - if: ${{ matrix.build == 'macos' }} - run: | - # FIX: No package 'gobject-introspection-1.0' found - # https://tutorials.technology/solved_errors/osx-gobject-introspection-1_0-found.html - brew install gobject-introspection - - - name: Install dependencies - macOS - if: ${{ matrix.build == 'macos' }} - run: | - python -m pip install --upgrade pip - pip install -r requirements-mac.txt - pip install pyinstaller==5.8.0 - - - name: Install dependencies - Windows - if: ${{ matrix.build == 'windows' }} - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pyinstaller==5.8.0 - - - name: Build macOS app - macOS - if: ${{ matrix.build == 'macos' }} - run: | - chmod +x build-macos.sh - ./build-macos.sh - # cd dist - ls -al dist - rm dist/MDCx - # `upload-artifact`会使文件丢失可执行权限。解决思路,先把`dist`打包成zip,再上传 - zip -r MDCx.app.zip dist - ls -al - - - name: Build Windows app - Windows - if: ${{ matrix.build == 'windows' }} - run: ./build-action + # - name: Set up Python + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # cache: pip + # + # - name: Install libraries + # if: ${{ matrix.build == 'macos' }} + # run: | + # # FIX: No package 'gobject-introspection-1.0' found + # # https://tutorials.technology/solved_errors/osx-gobject-introspection-1_0-found.html + # brew install gobject-introspection + # + # - name: Install dependencies - macOS + # if: ${{ matrix.build == 'macos' }} + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements-mac.txt + # pip install pyinstaller==5.8.0 + # + # - name: Install dependencies - Windows + # if: ${{ matrix.build == 'windows' }} + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt + # pip install pyinstaller==5.8.0 + # + # - name: Build macOS app - macOS + # if: ${{ matrix.build == 'macos' }} + # run: | + # chmod +x build-macos.sh + # ./build-macos.sh + # # cd dist + # ls -al dist + # rm dist/MDCx + # # `upload-artifact`会使文件丢失可执行权限。解决思路,先把`dist`打包成zip,再上传 + # zip -r MDCx.app.zip dist + # ls -al + # + # - name: Build Windows app - Windows + # if: ${{ matrix.build == 'windows' }} + # run: ./build-action # - name: Upload artifact - macOS # uses: actions/upload-artifact@v3 @@ -112,18 +112,30 @@ jobs: # path: | # .\MDCx + + - name: Get changelog + id: get-changelog + if: ${{ matrix.build == 'macos' }} + run: | + log=$(cat changelog.md) + echo "CHANGELOG=$log" >> $GITHUB_ENV + - name: Create Release - macOS uses: svenstaro/upload-release-action@2.7.0 if: ${{ matrix.build == 'macos' }} with: - asset_name: MDCx-$tag-${{ matrix.build }}-${{ matrix.arch }}.app.zip - file: MDCx.app.zip - prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-') }} + asset_name: macos.sh + file: build-macos.sh + prerelease: true + body: | + ${{ steps.get-changelog.outputs.CHANGELOG }} - name: Create Release - Windows uses: svenstaro/upload-release-action@2.7.0 if: ${{ matrix.build == 'windows' }} with: - asset_name: MDCx-$tag-${{ matrix.build }}-${{ matrix.arch }}.exe - file: dist/MDCx.exe - prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-') }} + asset_name: windows.ps1 + file: build-action.ps1 + prerelease: true + + diff --git a/build-conda.ps1 b/build-conda.ps1 deleted file mode 100644 index afe0ca0..0000000 --- a/build-conda.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -conda activate mdcx-py -$time = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" - -# 即时构建, 可选后缀 -$suffix = Read-Host -Prompt "Suffix(Optional)" -if ($suffix -ne "") -{ - $suffix = "-$suffix" -} -$FileName = "MDCx-$time$suffix.exe" - -# 正式版 -$release = Read-Host -Prompt "Release version(Optional)" -if ($release -ne "") -{ - $FileName = "MDCx-$release$suffix.exe" -} - - -Write-Output "Output File: $FileName" - -pyi-makespec -n "$FileName" -F ` --i resources/Img/MDCx.ico ` --w main.py ` --p "./src" ` ---add-data "resources;resources" ` ---add-data "libs;." ` ---hidden-import socks ` ---hidden-import urllib3 ` ---hidden-import _cffi_backend ` ---collect-all curl_cffi - -Remove-Item -Recurse -Force dist - -pyinstaller "$FileName.spec" - -Remove-Item -Recurse -Force build -Remove-Item -Force "$FileName.spec" - -Write-Output 'Done' \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 8ef3988..0000000 --- a/build.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -$time = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" - -$FileName = "MDCx-$time.exe" -Write-Output "Output File: $FileName" - -pyi-makespec -n "$FileName" -F ` --i resources/Img/MDCx.ico ` --w main.py ` --p "./src" ` ---add-data "resources;resources" ` ---add-data "libs;." ` ---hidden-import socks ` ---hidden-import urllib3 ` ---hidden-import _cffi_backend ` ---collect-all curl_cffi - -Remove-Item -Recurse -Force dist - -pyinstaller "$FileName.spec" - -Remove-Item -Recurse -Force build -Remove-Item -Force "$FileName.spec" - -Write-Output 'Done' \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..9aba99a --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +time=$(date +"%Y-%m-%d_%H-%M-%S") + +FileName="MDCx-$time.exe" +echo "Output File: $FileName" + +pyi-makespec -n "$FileName" -F \ +-i resources/Img/MDCx.ico \ +-w main.py \ +-p "./src" \ +--add-data "resources;resources" \ +--add-data "libs;." \ +--hidden-import socks \ +--hidden-import urllib3 \ +--hidden-import _cffi_backend \ +--collect-all curl_cffi + +rm -rf dist + +pyinstaller "$FileName.spec" + +rm -rf build +rm -f "$FileName.spec" + +echo 'Done' \ No newline at end of file diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..74b99da --- /dev/null +++ b/changelog.md @@ -0,0 +1,24 @@ +## 新增 +* test generate changelog +## 修复 +* None + +
+Full Changelog + +b6b8e86 Ver 120240119 +90b0b06 Fix: 识别 GETCHU-XXXX (#46) +4fba1ba Fix: update config after save (#38) +775c060 CI: build for tags +8a0dea5 CI: macos build +f84f2c6 Merge pull request #48 from northsea4/master +11302a2 Merge branch 'sqzw-x:master' into master +c001cb3 Fix: cant del custom website +f7fc1c6 CI: auto build for release +e432ccd fix release +38cb18f build with github actions +fd2a4be Add: github action build.yml +848f07b Fix: custom url +b6e57d4 Fix: airavcc get url list (#38) + +
diff --git a/changelog.ps1 b/changelog.ps1 deleted file mode 100644 index fedaa94..0000000 --- a/changelog.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$last = git describe --tags --abbrev=0 -(git log --pretty=format:"%h %s" "$last..") > changelog.txt diff --git a/changelog.sh b/changelog.sh new file mode 100644 index 0000000..6c0d1e6 --- /dev/null +++ b/changelog.sh @@ -0,0 +1,15 @@ +tags=$(git tag -l '120*' --sort=-v:refname) +last=$(echo "$tags" | sed -n '2p') +commitlog=$(git log --pretty=format:"%h %s" $last..HEAD) + +echo "## 新增 +* +## 修复 +* + +
+Full Changelog + +$commitlog + +
" > changelog.md # use "" to keep \n in $commitlog