Add Semantic Release to Auto Devops

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

Semantic versioning and release notes are best practices for a release manager. Today, we cannot automatically increment versions or generate releases. This would be especially helpful as an extension of AutoDevOps Templates.

AutoDevops would benefit from using auto-releases as a part of their CICD lifecycle and generation of auto-changelogs. This would be a great getting started with GitLab releases that have a straight forward commits to master strategy that indicates.

Intended users

User experience goal

As a developer, I want my AutoDevops template to auto-increment versions and generate releases.

Proposal

Integrate Semantic Release (https://semantic-release.gitbook.io/semantic-release/recipes/recipes/gitlab-ci), into AutoDevops template.

Extend the Auto-DevOps.gitlab-ci.yml template to include the Auto Release job by default.

stages:
  - release

semantic-release:
  image: node:12
  stage: release
  before_script:
    - npm install -g semantic-release @semantic-release/gitlab @semantic-release/exec
    - |
    cat <<-EOF >> .releaserc.yml
      ---
      verifyConditions:
        - "@semantic-release/gitlab"
      prepare: false
      publish:
        - "@semantic-release/gitlab"
      success: false
      fail: false
      npmPublish: false
      plugins:
        - "@semantic-release/commit-analyzer"
        - "@semantic-release/release-notes-generator"
        - "@semantic-release/gitlab"
        - - "@semantic-release/exec"
          - prepareCmd: "set-version ${nextRelease.version}"
            publishCmd: "publish-package"      
    EOF
  script:
    - semantic-release
  only:
    refs:
      - master
      - beta
      - /^\d+.x$/
      - /^\d+.\d+.x$/

# .gitlab-ci.yml
include:
  template: Releases/Semantic-Release.yml

test:
  script: test
Edited by 🤖 GitLab Bot 🤖