优化更新流程 #335
Workflow file for this run
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: Build Windows Executable | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' | |
# branches: | |
# - master | |
jobs: | |
build: | |
name: Build exe with launcher | |
runs-on: windows-latest | |
steps: | |
- name: Configure git | |
run: | | |
git config --global user.email "ok-oldking@users.noreply.github.com" | |
git config --global user.name "ok-oldking" | |
- name: Checkout source repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.OK_GH }} | |
fetch-depth: 0 | |
- name: Get Changes between Tags | |
id: changes | |
uses: simbo/changes-between-tags-action@v1 | |
with: | |
validate-tag: false | |
- name: Get tag name | |
id: tagName | |
uses: olegtarasov/get-tag@v2.1.3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12' # Use the version of Python you need | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Copy ok-script lib | |
run: | | |
python -m ok.update.copy_ok_folder | |
- name: amend git to add ok-script | |
run: | | |
git add -f ok/ | |
git commit --amend --no- | |
new_commit=$(git rev-parse HEAD) | |
tags=$(git tag --points-at HEAD@{1}) | |
for tag in $tags; do | |
git tag -d $tag | |
git tag $tag $new_commit | |
done | |
- name: Push to GitHub update | |
run: | | |
git remote add ghupdate https://ok-oldking:${{ secrets.OK_GH }}@github.com/ok-oldking/ok-ww-update.git | |
git push ghupdate --force HEAD:master | |
git push ghupdate --tags --force | |
- name: Push to Coding.net | |
run: | | |
git remote add coding https://${{ secrets.CODING_USERNAME }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/g-frfh1513/ok-wuthering-waves/ok-wuthering-waves.git | |
git push coding --force HEAD:master | |
git push coding --tags --force | |
- name: Build Executable | |
run: | | |
echo "tag: ${{ steps.changes.outputs.tag }}" | |
echo "changes: ${{ steps.changes.outputs.changes }}" | |
python -m ok.update.package_launcher ${{ steps.tagName.outputs.tag }} | |
python -m ok.update.gen_md5 .\dist | |
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse | |
7z a -t7z -r "ok-ww-release-${{ steps.tagName.outputs.tag }}.7z" "ok-ww" | |
7z a -tzip -r "ok-ww-${{ steps.tagName.outputs.tag }}.zip" "ok-ww" | |
Remove-Item -Path "ok-ww" -Recurse -Force | |
python -m ok.update.package_full_with_profile ${{ steps.tagName.outputs.tag }} 1 | |
python -m ok.update.gen_md5 .\dist | |
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse | |
7z a -t7z -r "ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z" "ok-ww" | |
Remove-Item -Path "ok-ww" -Recurse -Force | |
python -m ok.update.package_full_with_profile ${{ steps.tagName.outputs.tag }} 0 | |
python -m ok.update.gen_md5 .\dist | |
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse | |
7z a -t7z -r "ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z" "ok-ww" | |
Remove-Item -Path "ok-ww" -Recurse -Force | |
shell: pwsh | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
ok-ww-Nvidia-GPU-full (Nvidia GPU >=RTX2000 with latest driver) | |
ok-ww-CPU-full (AMD or other GPUs) | |
Updates: | |
${{ steps.changes.outputs.changes }} | |
draft: false | |
prerelease: true | |
- name: upload-7z | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./ok-ww-release-${{ steps.tagName.outputs.tag }}.7z | |
asset_name: ok-ww-release-${{ steps.tagName.outputs.tag }}.7z | |
asset_content_type: application/x-7z-compressed | |
- name: upload-zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./ok-ww-${{ steps.tagName.outputs.tag }}.zip | |
asset_name: ok-ww-${{ steps.tagName.outputs.tag }}.zip | |
asset_content_type: application/zip | |
- name: upload-7z-gpu | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z | |
asset_name: ok-ww-Nvidia-GPU-full-${{ steps.tagName.outputs.tag }}.7z | |
asset_content_type: application/x-7z-compressed | |
- name: upload-7z-cpu | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z | |
asset_name: ok-ww-CPU-full-${{ steps.tagName.outputs.tag }}.7z | |
asset_content_type: application/x-7z-compressed |