Skip to content

Commit

Permalink
Use npm list to get the version of elastic-apm-node (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
reakaleek authored Apr 26, 2024
1 parent 6af87e2 commit ea5fb3f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # also fetch tags
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies # This is needed to be able to run the npm list command
run: npm ci
- run: |
ELASTIC_APM_NODE_VERSION="v$(jq -r '.dependencies."elastic-apm-node".version' package-lock.json)"
ELASTIC_APM_NODE_VERSION=$(npm list --depth 0 --json elastic-apm-node | jq -r '.dependencies."elastic-apm-node".version')
ELASTIC_APM_NODE_VERSION_WITH_PREFIX="v${ELASTIC_APM_NODE_VERSION}"
# if the tag does not exist
if [[ ! $(git tag -l "${ELASTIC_APM_NODE_VERSION}") ]]; then
if [[ ! $(git tag -l "${ELASTIC_APM_NODE_VERSION_WITH_PREFIX}") ]]; then
git tag ${ELASTIC_APM_NODE_VERSION}
git push origin "refs/tags/${ELASTIC_APM_NODE_VERSION}"
git push origin "refs/tags/${ELASTIC_APM_NODE_VERSION_WITH_PREFIX}"
fi

0 comments on commit ea5fb3f

Please sign in to comment.