From e726d7acbdc5764ef64d4965fcb6c29c7b4591bd Mon Sep 17 00:00:00 2001 From: Michael Mell Date: Fri, 9 Aug 2024 17:01:20 +0200 Subject: [PATCH] Add actions to create release - build is now triggered, when a version tag is pushed - version string for release is obtained from the version tag --- .github/workflows/release-build.yml | 37 +++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 9056680..68092c3 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -6,11 +6,9 @@ name: .NET Core Desktop on: - [push] - # push: - # branches: [ "master" ] - # pull_request: - # branches: [ "master" ] + push: + tags: + - "*.*" jobs: build: @@ -46,3 +44,32 @@ jobs: - name: Package release run: .\Scripts\Make-Package.ps1 + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} # Use the tag name + release_name: Release ${{ github.ref_name }} + body: | + Description of the release. + draft: false + prerelease: false + + - name: Find the built ZIP file + id: find_zip + run: | + ZIP_FILE=$(find ./path/to/your/ -name "asset_*.zip" -print -quit) + echo "ZIP_FILE=$ZIP_FILE" >> $GITHUB_ENV + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.ZIP_FILE }} + asset_name: $(basename ${{ env.ZIP_FILE }}) + asset_content_type: application/zip