Skip to content

Commit

Permalink
feat: add semantic release stage (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil authored Nov 20, 2019
1 parent 6d5b12c commit 66c2c28
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---

include:
- /base_sementic_release_stage.yml

stages:
- Release

Release:
extends: .base_semantic_release_stage
9 changes: 9 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
message: "chore(release): version ${nextRelease.version}\n\n${nextRelease.notes}"
- "@semantic-release/github"
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,29 @@ An extend to build and publish some docker image.
| IMAGE_NAME | cdtn/api |
| CONTEXT | packages/api |
| DOCKER_BUILD_ARGS | --build-arg SENTRY_DSN=https://sentry |

# [.base_semantic_release_stage](./base_semantic_release_stage.yml)

## Usage

```yaml
---
include:
- "https://raw.githubusercontent.com/SocialGouv/gitlab-ci-yml/master/github-deployments.yml"
# or
# - "https://raw.githubusercontent.com/SocialGouv/gitlab-ci-yml/<version>/base_sementic_release_stage.yml"
#
Release:
extends: .base_semantic_release_stage
# or
Release:
extends: .base_semantic_release_stage
variables:
SEMANTIC_RELEASE_PLUGINS: "@semantic-release/changelog @semantic-release/git"
```
34 changes: 34 additions & 0 deletions base_sementic_release_stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#

.base_semantic_release_stage:
stage: "Release"
image: node:12
only:
refs:
- branches
when: manual
variables:
GIT_AUTHOR_EMAIL: 45039513+SocialGroovyBot@users.noreply.github.com
GIT_AUTHOR_NAME: Social Groovy Bot
GIT_COMMITTER_EMAIL: $GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME: $GIT_AUTHOR_NAME
#
# Additional plugins
SEMANTIC_RELEASE_PLUGINS: "@semantic-release/changelog @semantic-release/git"
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- $CI_PROJECT_DIR/.yarn
- node_modules
before_script:
script:
# Set git to a branch
- git checkout ${CI_COMMIT_REF_NAME}
# Use github as origin
- git remote set-url origin https://${GITHUB_TOKEN}@github.com/${CI_PROJECT_PATH}.git
# Use local yarn cache
- yarn config set cache-folder $CI_PROJECT_DIR/.yarn
# Install semantic-release
- yarn global add semantic-release $SEMANTIC_RELEASE_PLUGINS
# Run semantic-release
- semantic-release

0 comments on commit 66c2c28

Please sign in to comment.