Skip to content

cdn

cdn #254

Workflow file for this run

name: 打包
on:
push:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: 拉取代码
uses: actions/checkout@v5
- name: 获取版本
id: version
uses: juliangruber/read-file-action@v1
with:
path: version.json
- name: 设置变量
run: |
echo "NUITKA_PATH=$env:LOCALAPPDATA\Nuitka\Nuitka\Cache" >> $env:GITHUB_ENV
echo "PIP_PATH=$env:LOCALAPPDATA\pip\cache" >> $env:GITHUB_ENV
echo "WEEK=$(Get-Date -uformat %V)" >> $env:GITHUB_ENV
echo "VERSION=${{ fromJson(steps.version.outputs.content).version }}" >> $env:GITHUB_ENV
echo "DESCRIPTION<<EOF" >> $env:GITHUB_ENV
echo "${{ fromJson(steps.version.outputs.content).description }}" >> $env:GITHUB_ENV
echo "EOF" >> $env:GITHUB_ENV
- name: 查询标签
id: check
uses: action-pack/tag-exists@v1
with:
tag: v${{ env.VERSION }}
- name: 安装环境
if: steps.check.outputs.exists == 'false'
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: 依赖缓存
if: steps.check.outputs.exists == 'false'
uses: actions/cache@v4
with:
path: ${{ env.PIP_PATH }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: 安装依赖
if: steps.check.outputs.exists == 'false'
run: |
pip install -r requirements.txt
- name: 编译缓存
if: steps.check.outputs.exists == 'false'
uses: actions/cache@v4
with:
path: ${{ env.NUITKA_PATH }}
key: ${{ runner.os }}-nuitka-${{ env.WEEK }}
restore-keys: ${{ runner.os }}-nuitka-
- name: 开始编译
if: steps.check.outputs.exists == 'false'
run: |
.\build.ps1
- name: 上传文件
if: steps.check.outputs.exists == 'false'
uses: actions/upload-artifact@v5
with:
name: mole
path: D:/Downloads/*.exe
- name: 查询标签
if: steps.check.outputs.exists == 'false'
id: recheck
uses: action-pack/tag-exists@v1
with:
tag: v${{ env.VERSION }}
- name: 创建标签
if: steps.recheck.outputs.exists == 'false'
run: |
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: 发布版本
if: steps.check.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
name: ${{ env.VERSION }}
body: ${{ env.DESCRIPTION }}
tag_name: v${{ env.VERSION }}
files: D:/Downloads/*.exe