File tree Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- # Takes the version of elastic-apm in the Gemfile and creates a tag
2
+ # Creates a new GitHub release if the version in Gemfile changed in the main branch and
3
3
# if the tag does not exist yet.
4
4
name : create-tag
5
5
11
11
- Gemfile
12
12
13
13
permissions :
14
- contents : write
14
+ contents : read
15
15
16
16
jobs :
17
17
tag :
20
20
- uses : actions/checkout@v4
21
21
with :
22
22
fetch-depth : 0 # also fetch tags
23
- - run : |
24
- ELASTIC_APM_VERSION="v$(cat Gemfile | grep elastic-apm | awk 'BEGIN { FS=", " } { print $2 }' | tr -d \')"
25
- # if the tag does not exist
26
- if [[ ! $(git tag -l "${ELASTIC_APM_VERSION}") ]]; then
27
- git tag ${ELASTIC_APM_VERSION}
28
- git push origin "refs/tags/${ELASTIC_APM_VERSION}"
29
- fi
23
+
24
+ - run : make create-release
25
+ env :
26
+ GH_TOKEN : ${{ secrets.CREATE_TAG_TOKEN }}
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ name: release
3
3
on :
4
4
push :
5
5
branches : [ "main" ]
6
- create :
7
6
tags : [ "v*" ]
8
7
9
8
permissions :
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ PORT ?= 3000
2
2
IMAGE ?= opbeans/opbeans-ruby
3
3
VERSION ?= latest
4
4
LTS_ALPINE ?= 12-alpine
5
+ AGENT_VERSION =$(shell grep "elastic-apm" Gemfile | sed 's|.* , ||g' | tr -d \')
5
6
6
7
.PHONY : help
7
8
.DEFAULT_GOAL := help
@@ -35,3 +36,11 @@ publish: build ## Publish docker image
35
36
clean : # # Clean autogenerated files/folders
36
37
@rm -rf bats
37
38
@rm -rf target
39
+
40
+ create-release : # # Create github release given the APM Agent version if no tag release
41
+ @if [ -z " $( shell git tag -l v$( AGENT_VERSION) ) " ]; then \
42
+ echo " creating tag v$( AGENT_VERSION) " ; \
43
+ gh release create " v$( AGENT_VERSION) " --title=" $( AGENT_VERSION) " --generate-notes; \
44
+ else \
45
+ echo " git tag v$( AGENT_VERSION) already exists" ; \
46
+ fi
You can’t perform that action at this time.
0 commit comments