build: update build script

This commit is contained in:
cxfksword 2023-11-25 00:23:52 +08:00
parent 7776b87e18
commit 0ed27ce2f3
2 changed files with 11 additions and 17 deletions

View File

@ -43,14 +43,7 @@ jobs:
dotnet restore ${{ env.project }} --no-cache dotnet restore ${{ env.project }} --no-cache
dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }} dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }}
mkdir -p artifacts mkdir -p artifacts
cp ./Jellyfin.Plugin.MetaShark/bin/Release/net6.0/Jellyfin.Plugin.MetaShark.dll ./artifacts/ zip -j ./artifacts/${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ./Jellyfin.Plugin.MetaShark/bin/Release/net6.0/Jellyfin.Plugin.MetaShark.dll
- name: Compress build files
uses: thedoctor0/zip-release@main
with:
type: "zip"
directory: "artifacts"
filename: "${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip"
exclusions: "*.json *.pdb"
- name: Generate manifest - name: Generate manifest
run: cd artifacts && python3 ../generate_manifest.py ${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/} run: cd artifacts && python3 ../generate_manifest.py ${{ env.artifact }}_${{steps.vars.outputs.VERSION}}.zip ${GITHUB_REF#refs/*/}
- name: Deploy to jellyfin release repo - name: Deploy to jellyfin release repo
@ -61,13 +54,13 @@ jobs:
destination_dir: ${{ env.artifact }} destination_dir: ${{ env.artifact }}
publish_branch: master publish_branch: master
publish_dir: ./artifacts publish_dir: ./artifacts
- name: Publish release # - name: Publish release
uses: svenstaro/upload-release-action@v2 # uses: svenstaro/upload-release-action@v2
with: # with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./artifacts/${{ env.artifact }}_*.zip # file: ./artifacts/${{ env.artifact }}_*.zip
tag: ${{ github.ref }} # tag: ${{ github.ref }}
file_glob: true # file_glob: true
# - name: Publish manifest # - name: Publish manifest
# uses: svenstaro/upload-release-action@v2 # uses: svenstaro/upload-release-action@v2
# with: # with:

View File

@ -46,7 +46,7 @@ def main():
# 解析旧 manifest # 解析旧 manifest
try: try:
with urlopen('https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/manifest/maniest.json') as f: with urlopen('https://raw.githubusercontent.com/cxfksword/jellyfin-release/master/metashark/manifest.json') as f:
manifest = json.load(f) manifest = json.load(f)
except HTTPError as err: except HTTPError as err:
if err.code == 404: if err.code == 404:
@ -63,7 +63,8 @@ def main():
# 国内加速 # 国内加速
with open('manifest_cn.json', 'w') as f: with open('manifest_cn.json', 'w') as f:
manifest_cn = json.dumps(manifest, indent=2) manifest_cn = json.dumps(manifest, indent=2)
manifest_cn = re.sub("github.com", "gh-proxy.com/https://github.com", manifest_cn) manifest_cn = re.sub('https://github.com/cxfksword/jellyfin-plugin-metashark/raw/main/doc/logo.png', "https://jellyfin-plugin-release.pages.dev/metashark/logo.png", manifest_cn)
manifest_cn = re.sub('https://github.com/cxfksword/jellyfin-plugin-metashark/releases/download/v[0-9.]+', "https://jellyfin-plugin-release.pages.dev/metashark", manifest_cn)
f.write(manifest_cn) f.write(manifest_cn)