Home

Awesome

go-semantic-release/action

The official go-semantic-release GitHub Action.

:warning: This action always installs the latest release of go-semantic-release. Thus, the version of this repository is not linked to the used go-semantic-release version.

Usage

To integrate go-semantic-release with your GitHub Actions pipeline, specify the name of this repository with a version tag as a step within your workflow config file:

# If a 403 error occurs, make sure to set content permission to write
# see: https://github.com/go-semantic-release/action/issues/27
#permissions:
#  contents: write

steps:
  - uses: actions/checkout@master
  - uses: go-semantic-release/action@v1
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}

Arguments

InputDescriptionUsage
github-tokenUsed to create releasesRequired
changelog-fileCreate a changelog file (e.g CHANGELOG.md)Optional
ghrCreate a .ghr file with the parameters for tcnksm/ghrOptional
update-fileUpdate the version of a certain fileOptional
dryDo not create a releaseOptional
prereleaseFlags the release as a prereleaseOptional
allow-initial-development-versionssemantic-release will start your initial development release at 0.1.0 and will handle breaking changes as minor version updates. This option will be ignored if a release with major version greater than or equal 1 exists.Optional
force-bump-patch-versionIncrements the patch version if no changes are foundOptional
changelog-generator-optOptions that are passed to the changelog-generator plugin. Seperated by ","Optional
prependFlag changes to be prepended into the changelog fileOptional
hooksEnable different hooks plugins. Seperated by ","Optional

Example ci.yml for a npm package

name: CI
on:
  push:
    branches:
      - '**'
  pull_request:
    branches:
      - '**'

# If a 403 error occurs, make sure to set content permission to write
# see: https://github.com/go-semantic-release/action/issues/27
#permissions:
#  contents: write

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        node: [10, 12]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test
  release:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: 'https://registry.npmjs.org'
      - uses: go-semantic-release/action@v1
        id: semrel
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          update-file: package.json
          changelog-generator-opt: "emojis=true"
      - run: npm publish
        if: steps.semrel.outputs.version != ''
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

License

The MIT License (MIT)

Copyright © 2023 Christoph Witzko