diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e2488208..6867c017 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: @@ -49,12 +50,42 @@ 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 + 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. - # 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: @@ -106,52 +137,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' }} - 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 # Do I need to install this first? - with: - # user: microsoft - # project: CoseSignTool - output: CHANGELOG.md - token: ${{ secrets.GITHUB_TOKEN }} - # future-release: v1.0.0 - - - name: Commit changelog - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add CHANGELOG.md - git commit -m "Update changelog for release" - - - 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 }} @@ -196,28 +191,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: @@ -225,12 +199,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 + 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)*