Skip to content

Commit

Permalink
合并拉取请求 #14
Browse files Browse the repository at this point in the history
更新工作流
  • Loading branch information
XCWQW1 authored Aug 16, 2024
2 parents 19bb256 + e0fb785 commit 8c7e9b8
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
File renamed without changes.
88 changes: 88 additions & 0 deletions .github/workflows/release-build.yml
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

0 comments on commit 8c7e9b8

Please sign in to comment.