From 5da4e539572fe60b0b0677f073a4a9596f516cfb Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Sat, 2 Dec 2023 15:33:55 +0800 Subject: [PATCH] ci: update github action --- .github/workflows/test.yaml | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..cf36474 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,52 @@ +name: "Test" + +on: + workflow_dispatch: + +env: + dotnet-version: 6.0.x + python-version: 3.8 + project: Jellyfin.Plugin.MetaShark + artifact: metashark + +jobs: + build: + runs-on: ubuntu-latest + name: Build & Release + + steps: + - uses: actions/checkout@v3 + - name: Get tags (For CHANGELOG) + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + id: dotnet + with: + dotnet-version: ${{ env.dotnet-version }} + - name: Change default dotnet version + run: | + echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json + - name: Initialize workflow variables + id: vars + run: | + VERSION=$(echo "${GITHUB_REF#refs/*/}" | sed s/^v//) + VERSION="$VERSION.0" + echo ::set-output name=VERSION::${VERSION} + echo ::set-output name=APP_NAME::$(echo '${{ env.artifact }}_${{VERSION}}') + - name: Build + run: | + dotnet restore ${{ env.project }}/${{ env.project }}.csproj --no-cache + dotnet publish --nologo --no-restore --configuration=Release --framework=net6.0 -p:Version=${{steps.vars.outputs.VERSION}} ${{ env.project }} + mkdir -p artifacts + zip -j ./artifacts/${{APP_NAME}}.zip ./${{ env.project }}/bin/Release/net6.0/${{ env.project }}.dll + cp ./doc/logo.png ./artifacts/logo.png + - name: Generate manifest + run: cd artifacts && python3 ../scripts/generate_manifest.py ${{APP_NAME}}.zip ${GITHUB_REF#refs/*/} + - name: Deploy to jellyfin release repo + uses: peaceiris/actions-gh-pages@v3 + with: + personal_token: ${{ secrets.PAT }} + external_repository: cxfksword/jellyfin-release + destination_dir: test + publish_branch: master + publish_dir: ./artifacts