Skip to content

Commit

Permalink
fix: correctly check whether CI is running on release or not
Browse files Browse the repository at this point in the history
  • Loading branch information
npazosmendez committed Sep 30, 2024
1 parent f6757e8 commit 0dfdcc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
docker save -o build/carbon-relay-ng.tar grafana/carbon-relay-ng
- name: Store version
run: git describe --tags --always | sed 's/^v//' > build/version.txt
- run: cat build/version.txt
- name: Upload package artifacts
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
Expand All @@ -66,7 +65,7 @@ jobs:
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_type == 'tag'
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Download package artifacts
Expand All @@ -88,7 +87,7 @@ jobs:
run: |
version=$(cat build/version.txt)
repo=raintank/raintank
[[ "$version" == *-* ]] && repo=raintank/testing
[[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && repo=raintank/testing
package_cloud push $repo/ubuntu/trusty build/deb-upstart/carbon-relay-ng-*.deb
package_cloud push $repo/ubuntu/xenial build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/jessie build/deb-systemd/carbon-relay-ng-*.deb
Expand All @@ -107,7 +106,7 @@ jobs:
# only versions without a hyphen - e.g. actual releases - are tagged as latest.
# in-between-release versions are tagged as master.
tag=latest
[[ "$version" == *-* ]] && tag=master
[[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && tag=master
docker push grafana/carbon-relay-ng:$tag
github_binaries:
Expand Down
2 changes: 1 addition & 1 deletion build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version=$(git describe --tags --always | sed 's/^v//')
# note: we may want to extend this to also not tag as latest if working tree is dirty.
# but i think because of how go bindata works, it probably makes a change in the working tree.
tag=master
[[ "$GITHUB_EVENT_NAME" = "push" ]] && [[ "$GITHUB_REF_TYPE" = "tag" ]] && [[ "$version" != *-* ]] && tag=latest
[[ "$GITHUB_EVENT_NAME" = "push" ]] && [[ "$GITHUB_REF_TYPE" = "tag" ]] && [[ "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && tag=latest


docker build --tag=grafana/carbon-relay-ng:$tag .
Expand Down

0 comments on commit 0dfdcc7

Please sign in to comment.