Sha256: cf4369a12e7cde73eb080919ba6304bc75158556dc1689bc31f1c831dc096c6e

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

stages:
  - version
  - deploy
  - release

workflow:
  rules:
    # For merge requests, create a pipeline.
    - if: '$CI_MERGE_REQUEST_IID'
    # For default branch, create a pipeline.
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
    # For tags, never create pipeline.
    - if: '$CI_COMMIT_TAG'
      when: never

Update version:
  stage: version
  image: ruby:2.7
  before_script:
    - gem install gfsm
  script:
    - gfsm version bump --force > .version
    - gfsm changelog --force --output-file CHANGELOG.md
    - echo "RELEASE_VERSION=$(<.version)" >> variables.env
  artifacts:
    reports:
      dotenv: variables.env
    paths:
      - .version
      - CHANGELOG.md
    
# Publish gem:
# - GEM_HOST_API_KEY: A valid RubyGems API key.
Publish gem:
  stage: deploy
  image: ruby:2.7
  variables:
    GEMSPEC_FILE: "gfsm.gemspec"
    GEM_FILE: "gfsm-${RELEASE_VERSION}.gem"
  before_script:
    - |
      rm -f ./*.gem
      [ -f "${GEMSPEC_FILE}" ] || (echo "No ${GEMSPEC_FILE} file found!" && exit 1)
  script:
    - |
      gem build "${GEMSPEC_FILE}"
      [ -f "${GEM_FILE}" ] || (echo "No ${GEM_FILE} file found!" && exit 1)
      gem push "${GEM_FILE}"
  artifacts:
    paths:
      - "*.gem"
  rules:
    - if: '$GEM_HOST_API_KEY == null'
      when: never
    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
      when: never

Create release:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  script:
    - |
      release-cli create --name "Release v$RELEASE_VERSION" --description CHANGELOG.md --tag-name "v$RELEASE_VERSION"
  tags:
    - unix
  needs:
    - job: "Update version"
      artifacts: true
    - job: "Publish gem"
      artifacts: false
  rules:
    - if: '$GEM_HOST_API_KEY == null'
      when: never
    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
      when: never

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gfsm-0.1.2 .gitlab-ci.yml