Skip to content

Commit

Permalink
Updated circleci config.yaml. Retrieve version from artifact.
Browse files Browse the repository at this point in the history
CircleCI may fill the CIRCLE_TAG only if initially tags are pushed instead of tagless-commits. This is too easy to forget to do, therefore retrieve the version from the artifact and stick with the filter when to run the release job.

See https://support.circleci.com/hc/en-us/articles/360020342494-The-built-in-environment-variable-CIRCLE-TAG-is-not-present
  • Loading branch information
vinjana committed Apr 20, 2022
1 parent 28fe692 commit 3e06a37
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,30 @@ jobs: # a collection of steps
- run:
name: "Publish Release on GitHub"
command: |
ghr -t "$GITHUB_TOKEN" -u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" -c "$CIRCLE_SHA1" -n "$CIRCLE_TAG" -delete "$CIRCLE_TAG" ./build/libs/*.jar
VERSION=$(ls ./build/libs/*.jar | sed -r 's/.*RoddyToolLib-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?).jar/\1/')
ghr -t "$GITHUB_TOKEN" -u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" -c "$CIRCLE_SHA1" -n "$VERSION" -delete "$VERSION" ./build/libs/*.jar
workflows:
version: 2
workflow:
build:
jobs:
- build-and-test
release:
jobs:
- build-and-test:
filters:
branches: # ignore any commit on any branch by default
ignore: /.*/
tags: # unless they match the pattern
only: /^\d+\.\d+\.\d+$/
- publish-github-release:
context:
- TheRoddyWMS
requires:
- build-and-test
filters: # Only publish for proper version tags on the master branch.
branches:
only: master
tags:
filters:
branches: # ignore any commit on any branch by default
ignore: /.*/
tags: # unless they match the pattern
only: /^\d+\.\d+\.\d+$/

0 comments on commit 3e06a37

Please sign in to comment.