Skip to content

Commit

Permalink
fix: pipeline to release when merge to main
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmanderson committed Jun 16, 2022
1 parent 5b04d76 commit f7fc7b7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: publish

trigger:
event:
include:
- push
exclude:
- pull_request
- push
exclude:
- pull_request

image_pull_secrets:
- DOCKER_CONFIG_JSON

Expand All @@ -31,10 +31,9 @@ steps:
REPOSITORY_USERNAME:
from_secret: GEMFURY_TOKEN
commands:
- semantic-release publish -D commit_subject="{version} [CI SKIP]"
- semantic-release publish
when:
branch:
- main
branch: main

# if on a feature branch do a prerelease
- name: prerelease
Expand All @@ -50,8 +49,12 @@ steps:
from_secret: GEMFURY_TOKEN
commands:
# filter for fix and feat commits (other tags break semantic-release)
## ex. 'fix: dev-num' and 'feat: dev-num' are valid and `update algorithm` is not
- bash -c '[[ "$DRONE_COMMIT_MESSAGE" = fix:* ]] || [[ "$DRONE_COMMIT_MESSAGE" = feat:* ]]'
# ex. 'fix: dev-num' and 'feat: dev-num' are valid and `update docs` is not.
# also, semantic-release automatically commits version/changelog updates to the
# release branch. in order to prevent infinite "drone --> commit --> drone"
# loops, and to keep semantic-release from breaking, set semantic-release to be
# in `noop` mode if either of these is true (not fix/feat or triggered by itself).
- export PUBLISH_NOOP=$$(bash -c '[[ $DRONE_COMMIT_AUTHOR_NAME = "semantic-release" ]] || ([[ $DRONE_COMMIT_MESSAGE != fix:* ]] && [[ $DRONE_COMMIT_MESSAGE != feat:* ]])' && echo "--noop" || echo "")
# normalize branch name to alphanumeric (required by pep 440)
## ex. if on 'feature/Drone-Template2', LOCALID normalizes to 'DroneTemplate2'
- export LOCALID=$$(echo ${DRONE_SOURCE_BRANCH} | cut -c 9- | sed 's/[^a-z0-9]*//gi')
Expand All @@ -60,7 +63,7 @@ steps:
## result in a prerelease labeled '1.0.0-pre1+DroneTemplate.1'.
## local versions bump incrementally, so if existing projects specify deps
## semantically (or within a range), Poetry/pip should resolve correctly
- semantic-release publish --prerelease -D prerelease_tag="pre1+$${LOCALID}" -D branch="${DRONE_SOURCE_BRANCH}" -D commit_subject="{version} [CI SKIP]"
- semantic-release publish --prerelease -D prerelease_tag="pre1+$${LOCALID}" -D branch="${DRONE_SOURCE_BRANCH}" $${PUBLISH_NOOP}
when:
branch:
- feature/*
Expand Down

0 comments on commit f7fc7b7

Please sign in to comment.