From 675c2ce1c6aea27481982b9679d405c37f3dd0b0 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:09:59 -0700 Subject: [PATCH 01/16] move create_changelog to before build --- .github/workflows/dotnet.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e2488208..a901f682 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,6 +18,7 @@ on: jobs: build: name: build-${{matrix.os}} + needs: [ create_changelog ] runs-on: ${{ matrix.os }} strategy: matrix: @@ -119,8 +120,8 @@ jobs: # git config --local user.email " create_changelog: - #if: ${{ github.event_name != 'pull_request' }} - needs: [ create_release ] + if: ${{ github.event_name == 'pull_request' }} # This probably has to happen before build so the changelog is included in the release. + #needs: [ create_release ] runs-on: ubuntu-latest steps: - name: Checkout code From 0d9f4407cfb0365bebaaee7e8d299f5a80b8e30c Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:36:54 -0700 Subject: [PATCH 02/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index a901f682..e3fd5e9b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -128,7 +128,7 @@ jobs: uses: actions/checkout@v2 - name: Generate changelog - uses: tj-actions/github-changelog-generator@v1.19 # Do I need to install this first? + uses: tj-actions/github-changelog-generator@v1.19 with: # user: microsoft # project: CoseSignTool From 061e3e42f8be5c3b16cc3d6f9e2e1b331f06a545 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:05:43 -0700 Subject: [PATCH 03/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e3fd5e9b..312a563b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -127,6 +127,10 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Sync branch + run: | + git pull + - name: Generate changelog uses: tj-actions/github-changelog-generator@v1.19 with: From 12ab5e5236d6c7a650607bd793037975db35532d Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:07:56 -0700 Subject: [PATCH 04/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 312a563b..289820f4 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -127,10 +127,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Sync branch - run: | - git pull - - name: Generate changelog uses: tj-actions/github-changelog-generator@v1.19 with: @@ -144,6 +140,7 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" + git pull git add CHANGELOG.md git commit -m "Update changelog for release" From e0c144b0e1445d26553db2eacbd9b5bfa83475c4 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:16:55 -0700 Subject: [PATCH 05/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 289820f4..c007e303 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -140,9 +140,9 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git pull git add CHANGELOG.md git commit -m "Update changelog for release" + git push - name: Push changes # Or can I just use a 'git push' here? uses: ad-m/github-push-action@master # Master or Main? I think it's Master becuase it's talking about the action, not the target repo. From 12525063dd6d0f46363f7396de43f4e066567bca Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:22:00 -0700 Subject: [PATCH 06/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c007e303..2bf04655 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -142,7 +142,7 @@ jobs: git config --local user.name "GitHub Action" git add CHANGELOG.md git commit -m "Update changelog for release" - git push + git push origin HEAD:main - name: Push changes # Or can I just use a 'git push' here? uses: ad-m/github-push-action@master # Master or Main? I think it's Master becuase it's talking about the action, not the target repo. From b06fa76beb994c80ad6c7117a4179ec72b1882d2 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:34:04 -0700 Subject: [PATCH 07/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 2bf04655..7e34f623 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -140,9 +140,10 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" + git checkout main git add CHANGELOG.md git commit -m "Update changelog for release" - git push origin HEAD:main + git push origin main - name: Push changes # Or can I just use a 'git push' here? uses: ad-m/github-push-action@master # Master or Main? I think it's Master becuase it's talking about the action, not the target repo. From 79872a2726e789b098677b3f0661102b42a74791 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:37:35 -0700 Subject: [PATCH 08/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7e34f623..9aa94244 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -140,7 +140,7 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git checkout main + git checkout origin main git add CHANGELOG.md git commit -m "Update changelog for release" git push origin main From 317f329899ab474152f095162bf2fcc59c6dc1b1 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:39:04 -0700 Subject: [PATCH 09/16] Update dotnet.yml --- .github/workflows/dotnet.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9aa94244..9fda099d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -140,7 +140,6 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git checkout origin main git add CHANGELOG.md git commit -m "Update changelog for release" git push origin main From 22bdce8fc405eced2a92ffbc7ae8433a4c0de67c Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Wed, 13 Sep 2023 14:21:44 -0700 Subject: [PATCH 10/16] Try pushing to PR branch --- .github/workflows/dotnet.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9fda099d..d2bd73b5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -136,18 +136,21 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} # future-release: v1.0.0 - - name: Commit changelog + - name: Commit changelog # Try instead gettting the branch from $GITHUB_HEAD_REF and checking the change into there run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" + echo "Branch is ${{ github.event.pull_request.head.ref }}" git add CHANGELOG.md git commit -m "Update changelog for release" - git push origin main - - - name: Push changes # Or can I just use a 'git push' here? - uses: ad-m/github-push-action@master # Master or Main? I think it's Master becuase it's talking about the action, not the target repo. - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + git push origin ${{ github.event.pull_request.head.ref }} + + #git push origin main + + # - name: Push changes # Or can I just use a 'git push' here? + # uses: ad-m/github-push-action@master # Master or Main? I think it's Master becuase it's talking about the action, not the target repo. + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} release_assets: From 0d24fb6cabf7dd57623a1b215f7c9d391de5c9f8 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Wed, 13 Sep 2023 14:26:14 -0700 Subject: [PATCH 11/16] change ref format --- .github/workflows/dotnet.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d2bd73b5..b5da119f 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -140,10 +140,11 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - echo "Branch is ${{ github.event.pull_request.head.ref }}" + echo "PR Branch is ${{ github.event.pull_request.head.ref }}" + echo "Current branch is $GITHUB_HEAD_REF" git add CHANGELOG.md git commit -m "Update changelog for release" - git push origin ${{ github.event.pull_request.head.ref }} + git push origin $GITHUB_HEAD_REF #git push origin main From be95feec9fdf0b12444bb757b34cddfa6079a229 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Wed, 13 Sep 2023 14:30:38 -0700 Subject: [PATCH 12/16] checkout first --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b5da119f..d90de1b9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -140,11 +140,11 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - echo "PR Branch is ${{ github.event.pull_request.head.ref }}" echo "Current branch is $GITHUB_HEAD_REF" + git checkout $GITHUB_HEAD_REF git add CHANGELOG.md git commit -m "Update changelog for release" - git push origin $GITHUB_HEAD_REF + git push #git push origin main From 278a88a19507efa8c59501619b060cf7821d8eb5 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Wed, 13 Sep 2023 14:32:53 -0700 Subject: [PATCH 13/16] add a fetch --- .github/workflows/dotnet.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d90de1b9..274cd447 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -141,6 +141,7 @@ jobs: git config --local user.email "action@github.com" git config --local user.name "GitHub Action" echo "Current branch is $GITHUB_HEAD_REF" + git fetch git checkout $GITHUB_HEAD_REF git add CHANGELOG.md git commit -m "Update changelog for release" From 4da109729f0dec1526af5a42c1a0cbc4a887e112 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 Sep 2023 21:33:20 +0000 Subject: [PATCH 14/16] Update changelog for release --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..2dd5697b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +## [v0.0.0-pre.1](https://github.com/microsoft/CoseSignTool/tree/v0.0.0-pre.1) (2023-09-08) + +[Full Changelog](https://github.com/microsoft/CoseSignTool/compare/v0.3.1...v0.0.0-pre.1) + +**Merged pull requests:** + +- Try release [\#19](https://github.com/microsoft/CoseSignTool/pull/19) ([lemccomb](https://github.com/lemccomb)) +- try release [\#18](https://github.com/microsoft/CoseSignTool/pull/18) ([lemccomb](https://github.com/lemccomb)) +- Add license text to code files [\#17](https://github.com/microsoft/CoseSignTool/pull/17) ([lemccomb](https://github.com/lemccomb)) +- Add usage instructions [\#15](https://github.com/microsoft/CoseSignTool/pull/15) ([lemccomb](https://github.com/lemccomb)) +- Auto-build and upload on release [\#14](https://github.com/microsoft/CoseSignTool/pull/14) ([lemccomb](https://github.com/lemccomb)) + +## [v0.3.1](https://github.com/microsoft/CoseSignTool/tree/v0.3.1) (2023-08-04) + +[Full Changelog](https://github.com/microsoft/CoseSignTool/compare/171c25c3ada781341ce98149bf0d98794c2c8b68...v0.3.1) + +**Closed issues:** + +- Action required: self-attest your goal for this repository [\#8](https://github.com/microsoft/CoseSignTool/issues/8) + +**Merged pull requests:** + +- Add publish step [\#13](https://github.com/microsoft/CoseSignTool/pull/13) ([lemccomb](https://github.com/lemccomb)) +- Port from internal ADO repo [\#9](https://github.com/microsoft/CoseSignTool/pull/9) ([lemccomb](https://github.com/lemccomb)) +- updates from internal repo, compatibility with non-windows [\#7](https://github.com/microsoft/CoseSignTool/pull/7) ([elantiguamsft](https://github.com/elantiguamsft)) +- Delete unused files [\#5](https://github.com/microsoft/CoseSignTool/pull/5) ([JoeBussell](https://github.com/JoeBussell)) +- Create a GitHub action that will be used to build on PR to main. [\#4](https://github.com/microsoft/CoseSignTool/pull/4) ([JoeBussell](https://github.com/JoeBussell)) +- Replaced internal package feed with NuGet.org. [\#3](https://github.com/microsoft/CoseSignTool/pull/3) ([JoeBussell](https://github.com/JoeBussell)) +- Updating readme to highlight the tool first, then the library. [\#2](https://github.com/microsoft/CoseSignTool/pull/2) ([JoeBussell](https://github.com/JoeBussell)) +- Initial code submission [\#1](https://github.com/microsoft/CoseSignTool/pull/1) ([JoeBussell](https://github.com/JoeBussell)) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* From f790b96061b5daee107695318a7b90f568fc918f Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:21:30 -0700 Subject: [PATCH 15/16] cleanup --- .github/workflows/dotnet.yml | 114 +++++++++++------------------------ 1 file changed, 35 insertions(+), 79 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 274cd447..87932add 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -50,12 +50,36 @@ jobs: - name: List working directory run: ${{ matrix.dir_command }} + # Create a changelog that includes all the PRs merged since the last release. + # This has to happen in the PR build and not the release build so it can be committed to the current branch before it merges to Main. + create_changelog: + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Generate changelog + uses: tj-actions/github-changelog-generator@v1.19 + with: + output: CHANGELOG.md + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Commit changelog + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git fetch + git checkout $GITHUB_HEAD_REF + git add CHANGELOG.md + git commit -m "Update changelog for release" + git push + # If this is a pull request build, we're done. Otherwise: # 1. Create a release. - # 2. Generate a changelog. - # 3. Publish the binaries to ./published. - # 4. Zip the binaries. - # 5. Upload the zipped binaries to the release. + # 2. Publish the binaries to ./published. + # 3. Zip the binaries. + # 4. Upload the zipped binaries to the release. # Create a semantically versioned release. create_release: @@ -107,58 +131,16 @@ jobs: # This section will need tweaking once I see what the output looks like in context. # Does it make sense to use body_path and point to the changelog instead? # Or should I use the summary from the PR? - body: | - This is a new release. + # body: | + # This is a new release. + body_path: ./CHANGELOG.md draft: false prerelease: ${{ steps.semver-tag.outputs.is_prerelease }} - # - name: Create changelog - # if: ${{ github.event_name != 'pull_request' }} - # run: | - # dotnet tool install -g github-changelog-generator - # github_changelog_generator -u microsoft -p CoseSignTool -t ${{ secrets.GITHUB_TOKEN }} --future-release v1.0.0 - # git config --local user.email " - - create_changelog: - if: ${{ github.event_name == 'pull_request' }} # This probably has to happen before build so the changelog is included in the release. - #needs: [ create_release ] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Generate changelog - uses: tj-actions/github-changelog-generator@v1.19 - with: - # user: microsoft - # project: CoseSignTool - output: CHANGELOG.md - token: ${{ secrets.GITHUB_TOKEN }} - # future-release: v1.0.0 - - - name: Commit changelog # Try instead gettting the branch from $GITHUB_HEAD_REF and checking the change into there - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - echo "Current branch is $GITHUB_HEAD_REF" - git fetch - git checkout $GITHUB_HEAD_REF - git add CHANGELOG.md - git commit -m "Update changelog for release" - git push - - #git push origin main - - # - name: Push changes # Or can I just use a 'git push' here? - # uses: ad-m/github-push-action@master # Master or Main? I think it's Master becuase it's talking about the action, not the target repo. - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - - release_assets: name: release-assets - needs: [ build, create_changelog ] - # if: ${{ github.event_name != 'pull_request' }} + needs: [ build ] + if: ${{ github.event_name != 'pull_request' }} runs-on: ${{ matrix.os }} # env: # Can I declare this once for the whole job? # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -203,28 +185,7 @@ jobs: run: ${{ matrix.dir_command }} working-directory: ./published - # If this is a release build, upload the zipped artifacts. ** See if I can still do these with th svenstaro action - # - name: Upload release artifacts - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url }} - # asset_path: ./published/CoseSignTool-${{ matrix.os }}-release.zip - # asset_name: CoseSignTool-${{ matrix.os }}-release.zip - # asset_content_type: application/zip - - # # If this is a release build, upload the zipped artifacts. - # - name: Upload debug artifacts - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url}} - # asset_path: ./published/CoseSignTool-${{ matrix.os }}-debug.zip - # asset_name: CoseSignTool-${{ matrix.os }}-debug.zip - # asset_content_type: application/zip - + # Upload the zipped assets to the release. - name: Upload artifacts uses: svenstaro/upload-release-action@v2 with: @@ -232,12 +193,7 @@ jobs: file: ./published/CoseSignTool-*.zip file_glob: true overwrite: true - # uses: svenstaro/upload-release-action@v2 - # with: - # repo_token: ${{ secrets.GITHUB_TOKEN }} - # file: ./published/CoseSignTool-*.zip - # file_glob: true - # overwrite: true + From 9fecaf7ebb8d8cc5c7d84e4851e9e2003d745569 Mon Sep 17 00:00:00 2001 From: lemccomb <117306942+lemccomb@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:38:55 -0700 Subject: [PATCH 16/16] Deal with no changes case --- .github/workflows/dotnet.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 87932add..6867c017 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -72,8 +72,14 @@ jobs: git fetch git checkout $GITHUB_HEAD_REF git add CHANGELOG.md - git commit -m "Update changelog for release" - git push + if git diff-index --quiet HEAD; then + echo "No changes were logged." + else + git commit --allow-empty -m "Update changelog for release" + git push + fi + # git commit -m "Update changelog for release" + # git push # If this is a pull request build, we're done. Otherwise: # 1. Create a release.