name: Create Release on: workflow_call: jobs: create_release: runs-on: ubuntu-latest steps: - name: Parse Changelog Entry if: ${{ github.ref == 'refs/heads/master' }} id: changelog uses: coditory/changelog-parser@v1 # https://github.com/coditory/changelog-parser - name: Get last release if: ${{ github.ref == 'refs/heads/master' }} id: last_release uses: InsonusK/get-latest-release@v1.0.1 # https://github.com/InsonusK/get-latest-release with: myToken: ${{ secrets.GITHUB_TOKEN }} exclude_types: "draft|prerelease" view_top: 1 - name: Changelog Version if: ${{ github.ref == 'refs/heads/master' && ( steps.changelog.outputs.version == steps.last_release.tag_name ) }} # fail the workflow because the versions match run: | echo Changelog Version: "${{ steps.changelog.outputs.version }}" echo Last Released Version: "${{ steps.last_release.tag_name }}" exit 1 - name: Create/Update GitHub Release if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: ncipollo/release-action@v1 # https://github.com/ncipollo/release-action with: name: Release ${{ steps.changelog.outputs.version }} tag: ${{ steps.changelog.outputs.version }} artifacts: "./artifacts/*" token: ${{ secrets.GITHUB_TOKEN }} allowUpdated: true body: ${{ steps.changelog.outputs.description }}