diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f58e82..d269210 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,12 @@ jobs: with: node-version: latest + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies run: npm ci @@ -29,6 +35,7 @@ jobs: run: npm test - name: Check for version change + id: version-check run: | [ "$(git show head^:package.json | jq .version)" = "$(cat package.json| jq .version)" ] && echo "::set-output name=version_changed::true" || echo "::set-output name=version_changed::false" @@ -45,6 +52,15 @@ jobs: # don't try and deploy if versions haven't changed check-version: true - - name: Publish to github + - name: Create tag variable + id: tagging if: github.ref == 'refs/heads/master' && steps.version-check.outputs.version_changed == 'true' - run: npm run publish:github + run: echo "::set-output name=new_tag::v$(cat package.json | jq .version | sed "s/['\"]//g")" + + - name: Create a GitHub release + if: github.ref == 'refs/heads/master' && steps.version-check.outputs.version_changed == 'true' + uses: ncipollo/release-action@v1 + with: + custom_tag: ${{ steps.tagging.outputs.new_tag }} + name: Release ${{ steps.tagging.outputs.new_tag }] + body: ${{ steps.tag_version.outputs.changelog }}