NAStool Package #28
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: NAStool Package | |
on: | |
workflow_dispatch: | |
jobs: | |
Windows-build: | |
runs-on: windows-latest | |
steps: | |
- name: Init Python 3.10.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.10' | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Install dependent packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install wheel numpy==1.23.5 pyparsing==3.0.9 wxpython==4.2.0 pyinstaller==5.7.0 | |
pip install -r requirements.txt | |
echo ("NASTOOL_CONFIG=D:/a/nas-tools-dev/nas-tools-dev/nas-tools-dev/config/config.yaml") >> $env:GITHUB_ENV | |
echo $env:NASTOOL_CONFIG | |
cd third_party | |
git submodule init | |
git submodule update | |
shell: pwsh | |
- name: Package through pyinstaller | |
run: | | |
dir | |
copy .\package\rely\upx.exe c:\hostedtoolcache\windows\python\3.10.10\x64\Scripts | |
copy .\package\rely\hook-cn2an.py c:\hostedtoolcache\windows\python\3.10.10\x64\lib\site-packages\pyinstaller\hooks | |
copy .\package\rely\hook-zhconv.py c:\hostedtoolcache\windows\python\3.10.10\x64\lib\site-packages\pyinstaller\hooks | |
copy .\package\rely\hook-iso639.py c:\hostedtoolcache\windows\python\3.10.10\x64\lib\site-packages\pyinstaller\hooks | |
copy .\third_party.txt .\package | |
copy .\package\rely\template.jinja2 c:\hostedtoolcache\windows\Python\3.10.10\x64\lib\site-packages\setuptools\_vendor\pyparsing\diagram | |
xcopy .\web c:\hostedtoolcache\windows\python\3.10.10\x64\lib\site-packages\web\ /e | |
xcopy .\config c:\hostedtoolcache\windows\python\3.10.10\x64\lib\site-packages\config\ /e | |
xcopy .\scripts c:\hostedtoolcache\windows\python\3.10.10\x64\lib\site-packages\scripts\ /e | |
cd package | |
pyinstaller nas-tools.spec | |
dir | |
shell: pwsh | |
- name: Upload windows file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows | |
path: ./package/dist/nas-tools.exe | |
Create-release: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
needs: [Windows-build] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Release version | |
id: release_version | |
run: | | |
app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") | |
echo "app_version=$app_version" >> $GITHUB_ENV | |
- name: Download exe and rename | |
uses: actions/download-artifact@v3 | |
- name: get release_informations | |
shell: bash | |
run: | | |
pwd | |
ls -all | |
mkdir releases | |
mv ./windows/nas-tools.exe ./releases/nastool_win_v${{ env.app_version }}.exe | |
pwd | |
ls -all | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.app_version }} | |
release_name: v${{ env.app_version }} | |
body: ${{ github.event.commits[0].message }} | |
draft: false | |
prerelease: false | |
- name: Upload release asset | |
uses: dwenegar/upload-release-assets@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
assets_path: | | |
./releases/ |