From 92ed15eae3d44f1c1fb9a39230498eaaea0013ae Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 17 Oct 2024 20:35:10 -0400 Subject: [PATCH] change master push config, fix comments in pr validation action --- .github/workflows/build-release-binaries.yml | 6 +- .../workflows/create-release-with-asset.yml | 120 ++++++++++++++++++ .github/workflows/deploy-release-binaries.yml | 74 +++++------ 3 files changed, 159 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/create-release-with-asset.yml diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 8e8396a..426248f 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -1,7 +1,5 @@ -# This script builds the end user installer for Folder Size Calculator -# and then uses the installed to build the portal binaries -# the portal binaries are them compressed and uploaded to the -# github action as output. +# this script builds the solution and projects, just to see if they will successfully build +# before merging a pull request. name: build-release-binaries run-name: Release build for ${{ github.event_name }} triggered by ${{ github.triggering_actor }} concurrency: diff --git a/.github/workflows/create-release-with-asset.yml b/.github/workflows/create-release-with-asset.yml new file mode 100644 index 0000000..e4e0700 --- /dev/null +++ b/.github/workflows/create-release-with-asset.yml @@ -0,0 +1,120 @@ +# This script creates a release, builds the master branch and uploads the build +# results to both github actions store and the Release +name: create-release-with-asset +run-name: Release for ${{ github.event_name }} triggered by ${{ github.triggering_actor }} +concurrency: + group: release-create + cancel-in-progress: true +on: + push: + branches: + - master + paths-ignore: + - README.md + - CHANGELOG.md # Should never be edited anyway + - .gitignore + - .github/** + workflow_dispatch: + +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + release-asset-upload-url: ${{ steps.get-release-outputs.outputs.upload_url }} + steps: + # create a tag and a release + - name: Create Tag & Release + id: create-tag-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: rymndhng/release-on-push-action@master + with: + bump_version_scheme: minor + tag_prefix: v + use_github_release_notes: true + release_name: "Release " + release_body: "Bug fixes and features for stability of the application." + + # display the output of the release + - name: Check Output Parameters + id: get-release-outputs + run: | + echo "Got tag name ${{ steps.create-tag-release.outputs.tag_name }}" + echo "Got release version ${{ steps.create-tag-release.outputs.version }}" + echo "Upload release artifacts to ${{ steps.create-tag-release.outputs.upload_url }}" + echo "upload_url=${{ steps.create-tag-release.outputs.upload_url }}" >> $GITHUB_OUTPUT + + prepare-upload-asset: + runs-on: windows-latest + needs: [create-release] + steps: + # get the latest code from the repo + - name: Checkout Code + uses: actions/checkout@v4 + + # add msbuild to the PATH variable + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + + # run msbuild to create the executable + - name: build executable + id: build-ui-executable + working-directory: Solution + run: | + msbuild.exe ` + TrangTest.sln ` + /nologo ` + /nr:false ` + /p:DeployOnBuild=true ` + /p:DeployDefaultTarget=WebPublish ` + /p:WebPublishMethod=FileSystem ` + /p:DeleteExistingFiles=True ` + /p:platform="Any CPU" ` + /p:configuration="Release" ` + /p:PublishUrl="..\_build" ` + -fl + + # send build log to github output + - name: Upload Build Log + id: upload-build-log + uses: actions/upload-artifact@v4 + with: + name: build-executable-log + path: ${{ github.workspace }}\Solution\msbuild.log + retention-days: 5 + + # check for build success before continuing + - name: Upload Check + id: upload-check + if: ${{ steps.build-ui-executable.outcome != 'success' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('user-installer build failed, no sense continuing...') + + # zip the build output + - name: zip build artifact + id: zip-build-artifact + run: | + 7z a -tzip ${{ github.workspace }}\Build_Release.zip ${{ github.workspace }}\Solution\TrangTestStub\bin\Release\* + + # send build output to github output + - name: Upload Build Artifact + id: upload-build-artifact + uses: actions/upload-artifact@v4 + with: + name: build-executable-artifact + path: ${{ github.workspace }}\Build_Release.zip + retention-days: 5 + + # upload build output to release + - name: Upload Release Asset + id: upload-release-asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ needs.create-release.outputs.release-asset-upload-url }} + asset_path: ${{ github.workspace }}/Build_Release.zip + asset_name: Build_Release.zip + asset_content_type: application/zip diff --git a/.github/workflows/deploy-release-binaries.yml b/.github/workflows/deploy-release-binaries.yml index 5d716f4..2a6d144 100644 --- a/.github/workflows/deploy-release-binaries.yml +++ b/.github/workflows/deploy-release-binaries.yml @@ -5,14 +5,14 @@ concurrency: group: release-binaries cancel-in-progress: true on: - push: - branches: - - master - paths-ignore: - - README.md - - CHANGELOG.md # Should never be edited anyway - - .gitignore - - .github/** + # push: + # branches: + # - master + # paths-ignore: + # - README.md + # - CHANGELOG.md # Should never be edited anyway + # - .gitignore + # - .github/** workflow_dispatch: jobs: @@ -72,25 +72,25 @@ jobs: script: | core.setFailed('user-installer build failed, no sense continuing...') - # create a tag and a release - - name: Create Tag & Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - id: release - uses: rymndhng/release-on-push-action@master - with: - bump_version_scheme: patch - tag_prefix: v - use_github_release_notes: true - release_name: "Release " - release_body: "Bug fixes and features for stability of the application." + # # create a tag and a release + # - name: Create Tag & Release + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # id: release + # uses: rymndhng/release-on-push-action@master + # with: + # bump_version_scheme: patch + # tag_prefix: v + # use_github_release_notes: true + # release_name: "Release " + # release_body: "Bug fixes and features for stability of the application." - # display the output of the release - - name: Check Output Parameters - run: | - echo "Got tag name ${{ steps.release.outputs.tag_name }}" - echo "Got release version ${{ steps.release.outputs.version }}" - echo "Upload release artifacts to ${{ steps.release.outputs.upload_url }}" + # # display the output of the release + # - name: Check Output Parameters + # run: | + # echo "Got tag name ${{ steps.release.outputs.tag_name }}" + # echo "Got release version ${{ steps.release.outputs.version }}" + # echo "Upload release artifacts to ${{ steps.release.outputs.upload_url }}" # zip the build output - name: zip build artifact @@ -107,14 +107,14 @@ jobs: path: ${{ github.workspace }}\Build_Release.zip retention-days: 5 - # upload the build artifact to the release on github - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ${{ github.workspace }}\Build_Release.zip - asset_name: Build_Release.zip - asset_content_type: application/zip + # # upload the build artifact to the release on github + # - name: Upload Release Asset + # id: upload-release-asset + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + # asset_path: ${{ github.workspace }}\Build_Release.zip + # asset_name: Build_Release.zip + # asset_content_type: application/zip