githubgithub-actionscicdsemantic-release

How to publish a release with semantic-release on GitHub?


I am trying to publish my releases with semantic-release. Everything has worked well but the tool so far only generated tags rather than an actual GitHub Release.

My .releaserc

{
  "branches": "main",
  "plugins": [
    [
      "@semantic-release/npm",
      {
        "npmPublish": false
      }
    ],
    [
      "@semantic-release/commit-analyzer",
      {
        "releaseRules": [
          {
            "message": "CHANGE-*",
            "release": "patch"
          }
        ]
      }
    ],
    "@semantic-release/release-notes-generator"
  ]
}

and my release.yaml

name: Create Release

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Setup Node.js environment
        uses: actions/setup-node@v2.5.1

      - name: Env-Variables
        run: |
          echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_NONPROD }}"  >> $GITHUB_ENV
          echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_NONPROD }}" >> $GITHUB_ENV
          echo "GH_TOKEN=${{ secrets.SERVICE_TEAM_USER_TOKEN }}" >> $GITHUB_ENV
          export GH_TOKEN=${{ secrets.SERVICE_TEAM_USER_TOKEN }}

      - name: NPM Install
        run: |
          npm i
          npm i -g semantic-release

      - name: Create Release
        run: |
          semantic-release

How do I let semantic-release generate a github release instead of a tag?


Solution

  • As jonrsharpe pointed out, implementing the plugin semantic-release/github fixed my problem and tags and releases are now created automatically.