diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9c6573c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: ["*"] + +jobs: + build: + runs-on: windows-latest + + outputs: + artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} + + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Set version + id: set-version + uses: actions/github-script@v7 + with: + script: return context.ref.split("/")[2] + result-encoding: string + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Publish + run: dotnet publish -p:PublishSingleFile=true -p:Version=${{ steps.set-version.outputs.result }} -r win-x64 -c Release --no-self-contained + + - name: Upload artifact + id: upload-artifact + uses: actions/upload-artifact@v4 + with: + name: Data-Package-Tool-v${{ steps.set-version.outputs.result }}-${{ github.sha }} + path: .\src\bin\Release\net6.0-windows\win-x64\publish\* + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + draft: true + files: ./src/bin/Release/net6.0-windows/win-x64/publish/Data-Package-Tool.exe + name: Data Package Tool v${{ steps.set-version.outputs.result }} + token: ${{ secrets.ACCESS_TOKEN }} \ No newline at end of file