Files
Onekey/.github/workflows/release.yml
2025-06-06 20:53:22 +08:00

80 lines
2.5 KiB
YAML

name: Build
on:
push:
branches:
- main
jobs:
build:
permissions:
contents: write
runs-on: windows-latest
steps:
- name: Check out git repository
uses: actions/checkout@v4
- name: Get package version
shell: powershell
run: |
$version = (Get-Content package.json | ConvertFrom-Json).version
echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
- name: Create Executable
uses: sayyid5416/pyinstaller@main
with:
python_ver: "3.13.1"
spec: "main.py"
requirements: "requirements.txt"
options: --onefile, --name Onekey_v${{ env.PACKAGE_VERSION }}, --uac-admin, --uac-uiaccess, --icon ./icon.jpg
- name: Run UPX
uses: crazy-max/ghaction-upx@master
with:
version: latest
files: |
./dist/*.exe
args: -fq
- name: Create git tag
uses: pkgdeps/git-tag-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
version: ${{ env.PACKAGE_VERSION }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "v"
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.PACKAGE_VERSION }}
files: dist/Onekey_v${{ env.PACKAGE_VERSION }}.exe
prerelease: false
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Gitee Release
uses: nicennnnnnnlee/action-gitee-release@v1.0.5
with:
gitee_owner: ikun0014
gitee_repo: Onekey
gitee_token: ${{ secrets.GITEE_TOKEN }}
gitee_tag_name: v${{ env.PACKAGE_VERSION }}
gitee_release_name: v${{ env.PACKAGE_VERSION }}
gitee_release_body: I don't know
gitee_target_commitish: main
gitee_upload_retry_times: 3
gitee_file_name: Onekey_v${{ env.PACKAGE_VERSION }}.exe
gitee_file_path: dist/Onekey_v${{ env.PACKAGE_VERSION }}.exe
- name: Upload to Telegram Channel
run: |
& curl -F "chat_id=${{ secrets.TELEGRAM_TO }}" `
-F "thread_id=${{ secrets.TELEGRAM_THREAD }}" `
-F "document=@dist/Onekey_v${{ env.PACKAGE_VERSION }}.exe" `
-F "caption=Onekey's New Update ${{ env.PACKAGE_VERSION }}" `
-F "parse_mode=Markdown" `
"https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument"