Skip to content

docs: 更新 main 分支 README 平台说明 #55

docs: 更新 main 分支 README 平台说明

docs: 更新 main 分支 README 平台说明 #55

Workflow file for this run

name: Release
on:
push:
branches:
- main
- beta
workflow_dispatch:
inputs:
ref:
description: Git ref to build (tag/sha/branch). Leave empty to use current.
required: false
default: ""
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
outputs:
released: ${{ steps.semantic.outputs.released }}
version: ${{ steps.semantic.outputs.version }}
tag: ${{ steps.semantic.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python Semantic Release
id: semantic
if: github.event_name == 'push'
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: release
if: (github.event_name == 'push' && needs.release.outputs.released == 'true') || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-22.04
name: linux-amd64
- runner: windows-latest
name: windows-amd64
- runner: macos-14
name: darwin-arm64
- runner: macos-15-intel
name: darwin-amd64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || needs.release.outputs.tag || github.sha }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies (uv)
shell: bash
run: |
uv sync --no-install-project
uv pip install pyinstaller
- name: Build executable (PyInstaller onedir)
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
.venv/Scripts/python.exe -m PyInstaller hackbot.spec
else
.venv/bin/python -m PyInstaller hackbot.spec
fi
- name: Create release README (in package)
shell: bash
env:
RELEASE_VERSION: ${{ needs.release.outputs.version || needs.release.outputs.tag || github.ref_name }}
PLATFORM_NAME: ${{ matrix.name }}
run: |
python -m utils.release_docs package-readme \
--changelog CHANGELOG.md \
--version "${RELEASE_VERSION}" \
--platform "${PLATFORM_NAME}" \
--output dist/hackbot/README_RELEASE.md \
--project-name "Secbot"
cp README.md dist/hackbot/README.md
- name: Package artifact (zip)
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
python -c "import shutil,os; os.chdir('dist'); shutil.make_archive('secbot-${{ matrix.name }}', 'zip', '.', 'hackbot')"
else
.venv/bin/python -c "import shutil,os; os.chdir('dist'); shutil.make_archive('secbot-${{ matrix.name }}', 'zip', '.', 'hackbot')"
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: secbot-${{ matrix.name }}
path: dist/secbot-${{ matrix.name }}.zip
upload-assets:
needs: [release, build]
runs-on: ubuntu-latest
if: github.event_name == 'push' && needs.release.outputs.released == 'true'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release.outputs.tag }}
files: artifacts/**/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}