-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更新工作流
- Loading branch information
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
env: | ||
PYTHON_VERSION: '3.11' | ||
|
||
name: release-build | ||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: '检查 GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: '检查 tag' | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
tag_name="${GITHUB_REF##*/}" | ||
echo Tag $tag_name | ||
git checkout $tag_name | ||
echo "TAG_NAME=${tag_name}" >> $GITHUB_ENV | ||
- name: 初始化 Python ${{ env.PYTHON_VERSION }} 环境 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: '使用 pip 安装依赖' | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: '构建发行' | ||
shell: bash | ||
run: | | ||
python setup.py build | ||
- name: '上传发行' | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ env.TAG_NAME }} | ||
file: dist/DDNetTool* | ||
asset_name: DDNetToolBox-${{ runner.os }}-${{ env.TAG_NAME }}-* | ||
prerelease: true | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
environment: dev | ||
steps: | ||
- name: '检查 GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: '检查 tag' | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
tag_name="${GITHUB_REF##*/}" | ||
echo Tag $tag_name | ||
git checkout $tag_name | ||
echo "TAG_NAME=${tag_name}" >> $GITHUB_ENV | ||
- name: 初始化 Python ${{ env.PYTHON_VERSION }} 环境 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: '使用 pip 安装依赖' | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: '构建发行' | ||
shell: bash | ||
run: | | ||
python setup.py build | ||
- name: '上传发行' | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ env.TAG_NAME }} | ||
file: dist/DDNetTool* | ||
asset_name: DDNetToolBox-${{ runner.os }}-${{ env.TAG_NAME }}-* | ||
prerelease: true |