Skip to content

Commit

Permalink
use gh release instead
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Apr 30, 2024
1 parent 0d69d1a commit 2fff4ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
push:
branches:
- main
paths:
- package.json

permissions:
contents: write
contents: read

jobs:
tag:
Expand All @@ -18,14 +20,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # also fetch tags
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
with:
# This should help with running GitHub events
token: ${{ secrets.CREATE_TAG_TOKEN }}

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- run: make create-tag
- run: make create-release
env:
GH_TOKEN: ${{ secrets.CREATE_TAG_TOKEN }}
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PORT ?= 3000
IMAGE ?= opbeans/opbeans-node
VERSION ?= latest
LTS_ALPINE ?= 20-alpine
AGENT_VERSION=v$(shell npm ls --package-lock-only elastic-apm-node --json | jq -r '.dependencies."elastic-apm-node".version')
AGENT_VERSION=$(shell npm ls --package-lock-only elastic-apm-node --json | jq -r '.dependencies."elastic-apm-node".version')

.DEFAULT_GOAL := help

Expand Down Expand Up @@ -36,11 +36,10 @@ clean: ## Clean autogenerated files/folders
@rm -rf bats
@rm -rf target

create-tag: ## Create git tag given the APM Agent version
@if [ -z "$(shell git tag -l "$(AGENT_VERSION)")" ]; then \
echo "creating tag $(AGENT_VERSION)"; \
git tag $(AGENT_VERSION); \
git push origin "refs/tags/$(AGENT_VERSION)"; \
create-release: ## Create github release given the APM Agent version if no tag release
@if [ -z "$(shell git tag -l v$(AGENT_VERSION))" ]; then \
echo "creating tag v$(AGENT_VERSION)"; \
gh release create "v$(AGENT_VERSION)" --title="$(AGENT_VERSION)" --generate-notes; \
else \
echo "git tag $(AGENT_VERSION) already exists"; \
fi

0 comments on commit 2fff4ad

Please sign in to comment.