From 4aee3b699c4a0cc004fe62da9c87192c56bbfea3 Mon Sep 17 00:00:00 2001 From: Citrinate Date: Wed, 27 Dec 2023 19:19:49 -0500 Subject: [PATCH] Added workflows --- .github/RELEASE_TEMPLATE.md | 5 ++ .github/workflows/publish.yml | 83 ++++++++++++++++++++++++++++++++ FreePackages/FreePackages.csproj | 5 +- build.bat | 2 +- build.sh | 2 +- 5 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 .github/RELEASE_TEMPLATE.md create mode 100644 .github/workflows/publish.yml diff --git a/.github/RELEASE_TEMPLATE.md b/.github/RELEASE_TEMPLATE.md new file mode 100644 index 0000000..220ba4e --- /dev/null +++ b/.github/RELEASE_TEMPLATE.md @@ -0,0 +1,5 @@ +This version requires ArchiSteamFarm VX.X.X.X or newer + +### Changelog + +- diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..129abd4 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,83 @@ +name: publish + +on: [push, pull_request] + +env: + PLUGIN_NAME: "FreePackages" + DOTNET_SDK_VERSION: 8.0 + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4.1.1 + with: + submodules: recursive + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4.0.0 + with: + dotnet-version: ${{ env.DOTNET_SDK_VERSION }} + + - name: Verify .NET Core + run: dotnet --info + + - name: Prepare for publishing + run: dotnet restore + + - name: Run FreePackages.Tests + run: dotnet test FreePackages.Tests -p:ContinuousIntegrationBuild=true --nologo + + - name: Publish + run: | + dotnet publish ${{ env.PLUGIN_NAME }} -c "Release" -o "out/generic" -p:ContinuousIntegrationBuild=true --nologo + mkdir -p ./out/dist/${{ env.PLUGIN_NAME }} + cp ./out/generic/${{ env.PLUGIN_NAME }}.dll ./out/dist/${{ env.PLUGIN_NAME }} + + - name: Create README + uses: docker://pandoc/core:3.1 + with: + args: --metadata title="${{ env.PLUGIN_NAME }}" --standalone --columns 2000 -f markdown -t html --embed-resources --standalone -c ./github-pandoc.css -o ./out/dist/${{ env.PLUGIN_NAME }}/README.html README.md + + - name: Upload ${{ env.PLUGIN_NAME }} + uses: actions/upload-artifact@v4.0.0 + with: + name: ${{ env.PLUGIN_NAME }} + path: out/dist + + release: + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + needs: publish + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4.1.1 + + - name: Download ${{ env.PLUGIN_NAME }} artifact + uses: actions/download-artifact@v4.1.0 + with: + name: ${{ env.PLUGIN_NAME }} + path: out + + - name: Create Zip + run: | + cd out + 7z a -tzip -mx7 ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }} + + - name: Create ${{ env.PLUGIN_NAME }} GitHub release + uses: ncipollo/release-action@v1.13.0 + with: + artifacts: out/${{ env.PLUGIN_NAME }}.zip + artifactContentType: application/zip + name: ${{ env.PLUGIN_NAME }} V${{ github.ref_name }} + tag: ${{ github.ref_name }} + bodyFile: .github/RELEASE_TEMPLATE.md + token: ${{ secrets.GITHUB_TOKEN }} + makeLatest: false + prerelease: true + draft: true diff --git a/FreePackages/FreePackages.csproj b/FreePackages/FreePackages.csproj index d82cdb2..af90ec8 100644 --- a/FreePackages/FreePackages.csproj +++ b/FreePackages/FreePackages.csproj @@ -2,14 +2,15 @@ Citrinate - 1.3.2 + 1.3.3 enable latest net8.0 + true - + diff --git a/build.bat b/build.bat index f668580..6675bb5 100644 --- a/build.bat +++ b/build.bat @@ -21,7 +21,7 @@ if exist out rmdir /Q /S out rem release generic version -dotnet publish -c "Release" -f "net8.0" -o "out/generic" "/p:LinkDuringPublish=false" +dotnet publish FreePackages -c "Release" -f "net8.0" -o "out/generic" "/p:LinkDuringPublish=false" mkdir .\out\%CurrDirName% copy .\out\generic\%CurrDirName%.dll .\out\%CurrDirName% rem comment section below (downto :zip label) if you don't want to include documentation diff --git a/build.sh b/build.sh index af9cde1..aec9f0e 100755 --- a/build.sh +++ b/build.sh @@ -45,7 +45,7 @@ fi ## release generic version dotnet restore sync -dotnet publish -c "Release" -f net8.0 -o "out/generic" "/p:LinkDuringPublish=false" +dotnet publish FreePackages -c "Release" -f net8.0 -o "out/generic" "/p:LinkDuringPublish=false" mkdir ./out/$plugin_name cp ./out/generic/$plugin_name.dll ./out/$plugin_name if [[ -f "README.md" ]]; then