From 111023f836ad4d4b677bbb9a0296a5fa000303d3 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 2 Mar 2024 13:48:12 +0100 Subject: [PATCH 1/6] Remove unnecessary permissions in version-release workflow --- .github/workflows/version-release.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/version-release.yml b/.github/workflows/version-release.yml index 9cdfa06..53ee668 100644 --- a/.github/workflows/version-release.yml +++ b/.github/workflows/version-release.yml @@ -16,13 +16,6 @@ jobs: runs-on: windows-latest permissions: contents: write - checks: write - actions: read - issues: read - packages: write - pull-requests: read - repository-projects: read - statuses: read steps: - uses: actions/checkout@v4 From b976ff2c57276573bb1990303a250d12fc9f907d Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 2 Mar 2024 13:52:00 +0100 Subject: [PATCH 2/6] Specify build OutputPath --- .github/workflows/version-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version-release.yml b/.github/workflows/version-release.yml index 53ee668..bd4a8c5 100644 --- a/.github/workflows/version-release.yml +++ b/.github/workflows/version-release.yml @@ -29,7 +29,7 @@ jobs: run: nuget restore 2LCS/2LCS.csproj - name: Build - run: msbuild 2LCS/2LCS.csproj /p:Configuration=Release + run: msbuild 2LCS/2LCS.csproj /p:Configuration=Release /p:OutputPath=2LCS/bin/Release - name: Upload 2LCS_${{ github.event.release.tag_name }} .zip uses: actions/upload-artifact@v4 From 1a1139c51e1fae990c77e4f497a411e7fb3be04c Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 2 Mar 2024 14:06:25 +0100 Subject: [PATCH 3/6] Switch to manual trigger with release creation --- .github/workflows/version-release.yml | 45 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/.github/workflows/version-release.yml b/.github/workflows/version-release.yml index bd4a8c5..443bd02 100644 --- a/.github/workflows/version-release.yml +++ b/.github/workflows/version-release.yml @@ -1,15 +1,22 @@ # Action to build and release a new version of the project -# The workflow is triggered when a new release is created. -# The workflow builds the project and uploads the 2LCS.zip file to the release. -# The workflow uses the GitHub Actions upload-release-asset action to upload the 2LCS.zip file to the release. +# The workflow is triggered manually. +# The workflow builds the project, creates a new release and uploads the 2LCS.zip file to it. +# The workflow uses the GitHub Actions softprops/action-gh-release action to create the release with the 2LCS.zip file. # The action takes a number of parameters, which are documented in the action's repository. -name: Build and add to release +name: Build and add to new release -# trigger on a release +# trigger manually on: - release: - types: [published] + workflow_dispatch: + + inputs: + release_name: + description: 'Name of the release (e.g. v.0.47.0)' + required: true + version: + description: 'Version of the release (e.g. 0.47.0)' + required: true jobs: build: @@ -29,23 +36,23 @@ jobs: run: nuget restore 2LCS/2LCS.csproj - name: Build - run: msbuild 2LCS/2LCS.csproj /p:Configuration=Release /p:OutputPath=2LCS/bin/Release + run: msbuild 2LCS/2LCS.csproj /p:Configuration=Release /p:OutputPath=2LCS/bin/Release /p:Version=${{ inputs.version }} - - name: Upload 2LCS_${{ github.event.release.tag_name }} .zip + - name: Upload ${{ inputs.release_name }}.zip uses: actions/upload-artifact@v4 with: - name: 2LCS_${{ github.event.release.tag_name }} + name: 2LCS_${{ inputs.release_name }} path: 2LCS/bin/Release - name: Create zip file from content of release folder - run: Compress-Archive -Path 2LCS\bin\Release\* -DestinationPath 2LCS_${{ github.event.release.tag_name }}.zip + run: Compress-Archive -Path 2LCS\bin\Release\* -DestinationPath 2LCS_${{ inputs.release_name }}.zip - - name: Upload 2LCS .zip to release ${{ github.event.release.name }} - uses: shogo82148/actions-upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create release + uses: softprops/action-gh-release@v1 with: - upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=2LCS_${{ github.event.release.tag_name }}.zip - asset_path: 2LCS_${{ github.event.release.tag_name }}.zip - asset_name: 2LCS_${{ github.event.release.tag_name }}.zip - asset_content_type: application/zip + name: ${{ inputs.release_name }} + tag_name: ${{ inputs.release_name }} + draft: false + prerelease: true + generate_release_notes: true + files: 2LCS_${{ inputs.version }}.zip From a7dbe588b810bbb9dcca8158bdf8e85e9f1eedd9 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 2 Mar 2024 14:10:43 +0100 Subject: [PATCH 4/6] Fix workflow_dispatch inputs --- .github/workflows/version-release.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/version-release.yml b/.github/workflows/version-release.yml index 443bd02..6f9736d 100644 --- a/.github/workflows/version-release.yml +++ b/.github/workflows/version-release.yml @@ -9,14 +9,13 @@ name: Build and add to new release # trigger manually on: workflow_dispatch: - - inputs: - release_name: - description: 'Name of the release (e.g. v.0.47.0)' - required: true - version: - description: 'Version of the release (e.g. 0.47.0)' - required: true + inputs: + release_name: + description: 'Name of the release (e.g. v.0.47.0)' + required: true + version: + description: 'Version of the release (e.g. 0.47.0)' + required: true jobs: build: From f63f645170ca78a322de23ae817b653a363bf886 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 2 Mar 2024 14:16:13 +0100 Subject: [PATCH 5/6] Fix output path in build step --- .github/workflows/version-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version-release.yml b/.github/workflows/version-release.yml index 6f9736d..fd9a2f4 100644 --- a/.github/workflows/version-release.yml +++ b/.github/workflows/version-release.yml @@ -35,7 +35,7 @@ jobs: run: nuget restore 2LCS/2LCS.csproj - name: Build - run: msbuild 2LCS/2LCS.csproj /p:Configuration=Release /p:OutputPath=2LCS/bin/Release /p:Version=${{ inputs.version }} + run: msbuild 2LCS/2LCS.csproj /p:Configuration=Release /p:OutputPath=bin/Release /p:Version=${{ inputs.version }} - name: Upload ${{ inputs.release_name }}.zip uses: actions/upload-artifact@v4 From dad6442c9e3c5ff5e164ac284eeab76d31895d47 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 2 Mar 2024 14:19:54 +0100 Subject: [PATCH 6/6] Update release file name in version-release workflow --- .github/workflows/version-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version-release.yml b/.github/workflows/version-release.yml index fd9a2f4..5b47b73 100644 --- a/.github/workflows/version-release.yml +++ b/.github/workflows/version-release.yml @@ -54,4 +54,4 @@ jobs: draft: false prerelease: true generate_release_notes: true - files: 2LCS_${{ inputs.version }}.zip + files: 2LCS_${{ inputs.release_name }}.zip