diff --git a/.github/workflows/windows_x86-64_pack.yml b/.github/workflows/windows_x86-64_pack.yml index da4a653..aabe258 100644 --- a/.github/workflows/windows_x86-64_pack.yml +++ b/.github/workflows/windows_x86-64_pack.yml @@ -1,53 +1,27 @@ -name: Build windows x86-64 +name: Build windows x86-64 and Python AppImage on: push: branches: [ "master" ] jobs: - build: - + buildWindows: + name: Build windows x86-64 runs-on: windows-latest strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: HikariBot ref: 'master' - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: 3.10 - name: Latest-tag run: | cd HikariBot git tag Latest --force git push --force origin refs/tags/Latest:refs/tags/Latest cd .. - - name: Prepare phthon environment with conda - shell: cmd - run: | - cd HikariBot - call %CONDA%/condabin/conda.bat create --prefix .\pyenv python - call %CONDA%/condabin/conda.bat activate .\pyenv - python -m pip install --upgrade pip - python -m pip install nb-cli hikari-bot nonebot2[fastapi] hikari-core - python -m pip install nonebot-plugin-apscheduler - python -m pip install nonebot-plugin-gocqhttp - python -m pip install nonebot-plugin-guild-patch - set PLAYWRIGHT_BROWSERS_PATH=0 - python -m playwright install chromium - call %CONDA%/condabin/conda.bat deactivate - attrib -h .git - cd .. - - name: Pack windows x86-64 version - shell: pwsh - run: | - $tmp = Get-Content "HikariBot\.git\config" - echo $tmp |Select-String -NotMatch -Pattern "extraheader" | Set-Content "HikariBot\.git\config" - Compress-Archive -DestinationPath release.zip -Path HikariBot - name: Delete and create latest release uses: actions/github-script@v6 with: @@ -60,4 +34,35 @@ jobs: await github.rest.repos.deleteRelease({ owner, repo, release_id: id }) } const { data: { id } } = await github.rest.repos.createRelease({ owner, repo, tag_name: "Latest", name: "Latest Release" }) - await github.rest.repos.uploadReleaseAsset({ owner, repo, release_id: id, name: "release_windows.zip", data: await fs.readFile("release.zip") }) + + appimage: + name: Build python 3.9 AppImage + needs: buildWindows + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4 + with: + repository: niess/python-appimage + ref: 'master' + - name: Build + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + run: | + python -m python_appimage build manylinux \ + 2014_x86_64 cp39-cp39 + mv python3*.AppImage python3.9-cp39-cp39-manylinux2014_x86_64.AppImage + + - name: Upload Appimage + uses: actions/github-script@v6 + with: + script: | + const fs = require("fs").promises; + const { owner, repo } = context.repo + const { data } = await github.rest.repos.listReleases({ owner, repo }) + if ( data.length > 0){ + const { data: { id } } = await github.rest.repos.getLatestRelease({ owner, repo }) + await github.rest.repos.uploadReleaseAsset({ owner, repo, release_id: id, name: "python3.9-cp39-cp39-manylinux2014_x86_64.AppImage", data: await fs.readFile("python3.9-cp39-cp39-manylinux2014_x86_64.AppImage") }) + } diff --git a/install.sh b/install.sh index 6206ade..f30a53a 100644 --- a/install.sh +++ b/install.sh @@ -40,7 +40,9 @@ get_distribution() { download_python_appimage() { #url_python_AppImage=$(wget --quiet https://api.github.com/repos/niess/python-appimage/releases -O- | grep browser_download_url | grep python3.9 | grep manylinux2014_x86_64 | sed 's_^.*"\(https.*\)"$_\1_g' | sed 's/github.com/ghdown.obfs.dev/g') - url_python_AppImage="https://ghdown.obfs.dev/niess/python-appimage/releases/download/python3.9/python3.9.16-cp39-cp39-manylinux2014_x86_64.AppImage" + #url_python_AppImage="https://ghdown.obfs.dev/niess/python-appimage/releases/download/python3.9/python3.9.18-cp39-cp39-manylinux2014_x86_64.AppImage" + url_python_AppImage="https://ghdown.obfs.dev/94Bo/HikariBot/releases/download/Latest/python3.9-cp39-cp39-manylinux2014_x86_64.AppImage" + #TODO add multi url try? if command_exists curl; then curl "${url_python_AppImage}" --location --output python.AppImage else