This GitHub Action gets next semantic release info, does not publish. export the info as output variables.
Add this step in your workflow file
- name: Gets semantic release info
id: semantic_release_info
uses: jossef/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
type
- The part of the version incremented - major/minor/patchchannel
- The distribution channel on which the last release was initially made availablegit_head
- The sha of the last commit being part of the releaseversion
- The version of the releasegit_tag
- The Git tag associated with the releasename
- The name of the releasenotes
- The release notes of the release (a summary of git commits)
output variables can be accessed after the step is completed via
${{ steps.semantic_release_info.outputs.<variable name> }}
In this example I build auto generated docs, commit the built docs artifacts and make a tagged release
name: CI
on:
push:
branches:
- '**'
tags-ignore:
- '*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Gets semantic release info
id: semantic_release_info
uses: jossef/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Build auto generated docs
run: |
npm install
npm run build-docs
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "docs(): bumping release ${{ steps.semantic_release_info.outputs.git_tag }}"
git tag ${{ steps.semantic_release_info.outputs.git_tag }}
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ github.token }}
tags: true
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.semantic_release_info.outputs.git_tag }}
release_name: ${{ steps.semantic_release_info.outputs.git_tag }}
body: ${{ steps.semantic_release_info.outputs.notes }}
draft: false
prerelease: false