From 937068f9b102917a882b3cf0a002c99577dd0aa5 Mon Sep 17 00:00:00 2001 From: Ahmed Magdy Date: Wed, 24 Apr 2024 02:02:03 +0300 Subject: [PATCH] The most significant changes involve the update of the `TAG_NAME` environment variable and the correction of conditional statements in the `build-and-release.yml` file. The `TAG_NAME` environment variable now uses the `Version` input instead of the `CreateRelease` input. The conditional statements in the `build-and-release.yml` file have been corrected to use the proper syntax for GitHub Actions. This includes conditions for building the app, uploading a build artifact, creating a tag, creating a release draft, and uploading the MSI to the release. Additionally, the `SelfContained` and `CreateRelease` inputs are now correctly checked for both `true` and `false` values in the respective conditions. Changes: 1. The `TAG_NAME` environment variable in the `build-and-release.yml` file has been updated to use the `Version` input instead of the `CreateRelease` input. 2. The conditional statements in the `build-and-release.yml` file have been updated to use the correct syntax for GitHub Actions. This includes the conditions for building the app, uploading a build artifact, creating a tag, creating a release draft, and uploading the MSI to the release. 3. The `SelfContained` input is now being correctly checked for both `true` and `false` values in the conditions for building the app. 4. The `CreateRelease` input is now being correctly checked for both `true` and `false` values in the conditions for uploading a build artifact, creating a tag, creating a release draft, and uploading the MSI to the release. --- .github/workflows/build-and-release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b05e736..4c2092f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -25,7 +25,7 @@ permissions: env: VERSION: ${{ github.event.inputs.Version }} SELF_CONTAINED: ${{ github.event.inputs.SelfContained }} - TAG_NAME: v${{ github.event.inputs.CreateRelease }} + TAG_NAME: v${{ github.event.inputs.Version }} jobs: build: @@ -69,11 +69,11 @@ jobs: run: dotnet restore src - name: 🏗️ Build App - if: github.event.inputs.SelfContained == false + if: ${{ github.event.inputs.SelfContained == false }} run: dotnet publish ${{env.APP_PROJECT_PATH}} -c=Release -o=${{env.APP_PROJECT_OUTPUT}} --p:FileVersion=${{env.VERSION}} --p:AssemblyVersion=${{env.VERSION}} --p:Version=${{env.VERSION}} -p:SourceRevisionId=${{ github.sha }} - name: 🏗️ Build App (Self-contained) - if: github.event.inputs.SelfContained + if: ${{ github.event.inputs.SelfContained == true }} run: dotnet publish ${{env.APP_PROJECT_PATH}} -c=Release -o=${{env.APP_PROJECT_OUTPUT}} --p:FileVersion=${{env.VERSION}} --p:AssemblyVersion=${{env.VERSION}} --p:Version=${{env.VERSION}} -r=win-x64 --self-contained=true -p:SourceRevisionId=${{ github.sha }} - name: 🔧 Setup WiX v5 @@ -83,14 +83,14 @@ jobs: run: dotnet build ${{env.MSI_PROJECT_PATH}} -c=Release -o=${{env.MSI_PROJECT_OUTPUT}} -p:Version=${{env.VERSION}} -p:AppDir=${{env.APP_PROJECT_OUTPUT}} -p:OutputName=${{env.MSI_FILE_NAME}} -p:SourceRevisionId=${{ github.sha }} - name: 📤 Upload a Build Artifact - if: github.event.inputs.CreateRelease == false + if: ${{ github.event.inputs.CreateRelease == false }} uses: actions/upload-artifact@v4.3.1 with: name: ${{env.MSI_FILE_NAME}} path: ${{env.MSI_PROJECT_OUTPUT}}\${{env.MSI_FILE_NAME}}.msi - name: 🏷️ Create tag ${{ github.event.inputs.Version }} - if: github.event.inputs.CreateRelease + if: ${{ github.event.inputs.CreateRelease == true }} run: | git tag ${{ github.event.inputs.Version }} git push origin ${{ github.event.inputs.Version }} @@ -98,13 +98,13 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 📝 Create release draft ${{ env.TAG_NAME }} - if: github.event.inputs.CreateRelease + if: ${{ github.event.inputs.CreateRelease == true }} run: gh release create ${{ env.TAG_NAME }} --target ${{ github.ref }} --draft --title "${{ env.TAG_NAME }}" --generate-notes --prerelease --draft env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 📤 Upload MSI to release ${{ env.TAG_NAME }} - if: github.event.inputs.CreateRelease + if: ${{ github.event.inputs.CreateRelease == true }} run: gh release upload ${{ env.TAG_NAME }} ${{env.MSI_PROJECT_OUTPUT}}\${{env.MSI_FILE_NAME}}.msi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}