wxhgxb is generate upper tool 🚀 #2
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: The upper computer packages tasks automatically | |
run-name: ${{ github.actor }} is generate upper tool 🚀 | |
on: | |
push: | |
paths: | |
- 'firmware/**' | |
jobs: | |
GitHub-Generate-Pack: | |
runs-on: windows-2019 | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
# 拿到发生更改的文件,即本次上传的固件 | |
- name: Get changed files | |
id: file_changes | |
uses: tj-actions/changed-files@v42 | |
- name: Print info | |
run: | | |
echo '${{ steps.file_changes.outputs.all_changed_files}}' | |
- run: git clone ${{ secrets.SOURCE_REPOSITORY }} wb_upper_tool ; if ($?) { echo "Clone successful" } else { echo "Failed to clone repository" } | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.8" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if (Test-Path "wb_upper_tool\requirements.txt") { | |
pip install -r "wb_upper_tool\requirements.txt" | |
} | |
- name: Execute Python Script | |
run: | | |
$changed_files = "${{ steps.file_changes.outputs.all_changed_files }}" | |
if ($changed_files -ne "") { | |
$first_file = ($changed_files -split '\r?\n')[0] | |
python .\wb_upper_tool\generate_tool.py $first_file | |
} | |
else { | |
echo "No changed files detected." | |
exit 0 | |
} | |
- run: ls .\wb_upper_tool\dist\* | |
- name: Upload packages results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: upper_tool | |
path: .\wb_upper_tool\dist\* |