feat: 支持关闭某个平台的服务 #109
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: Build Release | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- '**.md' | |
- '.gitignore' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build: | |
if: contains(github.event.head_commit.message, '[release]') | |
strategy: | |
matrix: | |
runs-on: [windows-latest, macos-latest, ubuntu-latest] | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v2 | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install pyinstaller | |
run: python -m pip install pyinstaller | |
- name: Install dependencies | |
run: python -m pip install -r ./requirements.txt | |
- name: Build | |
run: python build.py build release | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.runs-on }} | |
path: ./dist | |
release: | |
if: contains(github.event.head_commit.message, '[release]') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v3 | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Get version | |
run: | | |
python -m pip install toml | |
echo PACKAGE_VERSION=`python -c 'import toml; print(toml.load("./pyproject.toml")["tool"]["poetry"]["version"])'` >> $GITHUB_ENV | |
- name: Generate Changelog | |
run: | | |
git fetch --prune --unshallow --tags | |
python build.py changelog >> ./changelog.md | |
- name: Create git tag | |
uses: pkgdeps/git-tag-action@v2 | |
with: | |
github_token: ${{ github.token }} | |
github_repo: ${{ github.repository }} | |
version: ${{ env.PACKAGE_VERSION }} | |
git_commit_sha: ${{ github.sha }} | |
git_tag_prefix: "v" | |
- name: Download Build Files | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: dist-* | |
merge-multiple: false | |
- name: Rename Files | |
run: | | |
mv ./dist/dist-windows-latest/lx-music-api-server_${{ env.PACKAGE_VERSION }}.exe ./dist/lx-music-api-server_${{ env.PACKAGE_VERSION }}_windows.exe | |
mv ./dist/dist-macos-latest/lx-music-api-server_${{ env.PACKAGE_VERSION }} ./dist/lx-music-api-server_${{ env.PACKAGE_VERSION }}_macos | |
mv ./dist/dist-ubuntu-latest/lx-music-api-server_${{ env.PACKAGE_VERSION }} ./dist/lx-music-api-server_${{ env.PACKAGE_VERSION }}_ubuntu | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: ./changelog.md | |
prerelease: false | |
draft: false | |
tag_name: v${{ env.PACKAGE_VERSION }} | |
files: | | |
./dist/lx-music-api-server_${{ env.PACKAGE_VERSION }}_windows.exe | |
./dist/lx-music-api-server_${{ env.PACKAGE_VERSION }}_macos | |
./dist/lx-music-api-server_${{ env.PACKAGE_VERSION }}_ubuntu | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |