feat:添加 GitHub 访问不可达测试 (#81) #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Install and Test LL on Linux Old | |
on: | |
push: | |
paths: | |
- 'install_linux.sh' | |
- '.github/workflows/linux.yml' | |
pull_request: | |
paths: | |
- 'install_linux.sh' | |
- '.github/workflows/linux.yml' | |
workflow_dispatch: | |
jobs: | |
install_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 # 指定 Python 3 版本 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libsecret-1-0 | |
python3 -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Download and Install QQ Software | |
run: | | |
python3 get_qqnt.py Debianx64 | |
sudo dpkg -i LinuxQQ.deb | |
sudo apt-get install -f | |
- name: Run install_linux.sh | |
run: | | |
chmod +x install_linux.sh | |
./install_linux.sh | |
- name: Check output and directory existence | |
run: | | |
if ! /opt/QQ/qq --logging-enable | grep -q "[LiteLoader]" || [ ! -d "/opt/LiteLoader/plugins" ]; then | |
echo "LiteLoader not found in output or /opt/LiteLoader/plugins directory does not exist. Test failed." | |
exit 1 | |
else | |
echo "LiteLoader found in output and /opt/LiteLoader/plugins directory exists. Test succeeded." | |
fi | |
release: | |
runs-on: ubuntu-latest | |
needs: install_and_test | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get recent commit messages | |
id: get_commit_messages | |
run: echo "::set-output name=commit_messages::$(git log -5 --pretty=format:'%h - %s')" | |
- name: Create release body | |
id: create_release_body | |
run: | | |
echo "Recent Commits:" >> release_body.txt | |
echo "${{ steps.get_commit_messages.outputs.commit_messages }}" >> release_body.txt | |
shell: bash | |
- name: Check if release exists | |
id: check_release | |
run: | | |
if gh release view "pro-release" > /dev/null 2>&1; then | |
echo "::set-output name=release_exists::true" | |
else | |
echo "::set-output name=release_exists::false" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.AC_TOKEN }} | |
- name: Get existing release body | |
if: steps.check_release.outputs.release_exists == 'true' | |
id: get_existing_body | |
run: | | |
gh release view "pro-release" --json body --jq .body > existing_body.txt | |
env: | |
GITHUB_TOKEN: ${{ secrets.AC_TOKEN }} | |
- name: Combine release body | |
if: steps.check_release.outputs.release_exists == 'true' | |
run: | | |
cat existing_body.txt >> release_body.txt | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: pro-release | |
draft: false | |
prerelease: true | |
body_path: release_body.txt | |
files: | | |
install_linux.sh | |
install.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.AC_TOKEN }} |