Last active
May 29, 2020 16:07
-
-
Save aafaque33/76df63338154e350af92cfe6793c5978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- build | |
build_badges: | |
stage: build | |
tags: | |
- docker-build | |
before_script: | |
- chmod +x get-updated-badge-info.sh | |
script: | |
- echo "Some script to build your code" | |
after_script: | |
- ./get-updated-badge-info.sh | |
artifacts: | |
paths: | |
- badges.json | |
when: always | |
expire_in: 4 weeks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "collecting stas for badges" | |
commits=`git rev-list --all --count` | |
latest_release_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "{\"commits\":\"$commits\", \"release_tag"\:\"$latest_release_tag\"}" > badges.json |
Also you have to change the link to the badges.json to: @aafaque33
https://gitlab.com/<user>/<project>/-/jobs/artifacts/master/raw/badges.json?job=build_badges
https://img.shields.io/badge/dynamic/json.svg?label=Release&url=https://gitlab.com/<user>/<project>/-/jobs/artifacts/master/raw/badges.json?job=build_badges&query=release_tag&colorB=brightgreen
As you can see here:
https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#downloading-the-latest-artifacts
The access to the artifact files has changed.
I have made a sample repository here: https://gitlab.com/asdoi/gitlab_badges_sample
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
at
release_tag"\
you have to change it into at
release_tag\"