Add Changelog action to CI release
Add an action which creates a Release with the content of the changelog.
on:
push:
tags:
- - 'v*'
- - 'macros-v*'
+ - "v*"
+ - "macros-v*"
name: Publish to crates.io
jobs:
@@ -16,6 +16,30 @@ jobs:
profile: minimal
toolchain: stable
override: true
+ - name: Get version from tag
+ id: tag_name
+ run: |
+ echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
+ shell: bash
+ - name: Get Changelog Entry
+ id: changelog_reader
+ uses: mindsers/changelog-reader-action@v2
+ with:
+ version: ${{ steps.tag_name.outputs.current_version }}
+ path: ./CHANGELOG.md
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ # This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object.
+ # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
+ tag_name: "v${{ steps.changelog_reader.outputs.version }}"
+ release_name: "serde_with v${{ steps.changelog_reader.outputs.version }}"
+ body: ${{ steps.changelog_reader.outputs.changes }}
+ prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
+ draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
- run: cargo login ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
@@ -31,6 +55,30 @@ jobs:
profile: minimal
toolchain: stable
override: true
+ - name: Get version from tag
+ id: tag_name
+ run: |
+ echo ::set-output name=current_version::${GITHUB_REF#refs/tags/macros-v}
+ shell: bash
+ - name: Get Changelog Entry
+ id: changelog_reader
+ uses: mindsers/changelog-reader-action@v2
+ with:
+ version: ${{ steps.tag_name.outputs.current_version }}
+ path: ./serde_with_macros/CHANGELOG.md
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ # This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object.
+ # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
+ tag_name: "macros-v${{ steps.changelog_reader.outputs.version }}"
+ release_name: "serde_with_macros v${{ steps.changelog_reader.outputs.version }}"
+ body: ${{ steps.changelog_reader.outputs.changes }}
+ prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
+ draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
- run: cargo login ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
