Skip to content

Commit

Permalink
test add appimage build
Browse files Browse the repository at this point in the history
  • Loading branch information
94Bo committed Nov 5, 2023
1 parent 8b69e7c commit 03bb9c1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
67 changes: 36 additions & 31 deletions .github/workflows/windows_x86-64_pack.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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") })
}
4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 03bb9c1

Please sign in to comment.