Skip to content

Commit 269f94e

Browse files
committed
Add publish release script
1 parent b32e140 commit 269f94e

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Terraform Provider release workflow.
21
name: Release
32

43
# This GitHub action creates a release when a tag that matches the pattern
@@ -28,4 +27,4 @@ jobs:
2827
GIT_TAG: ${{ env.GIT_TAG }}
2928
GITHUB_CONTAINER_REGISTRY_TOKEN: ${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }}
3029
GITHUB_USERNAME: ${{ github.actor }}
31-
run: make publish
30+
run: make release

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ DIST_FOLDER ?= ./dist
55
test:
66
helm lint chart/
77

8-
publish:
8+
release:
99
mkdir -p ${DIST_FOLDER}
1010
helm package chart/ --app-version ${VERSION} --destination ${DIST_FOLDER}/ --version ${VERSION}
1111
helm registry login ghcr.io --username ${GITHUB_USERNAME} --password ${GITHUB_CONTAINER_REGISTRY_TOKEN}
1212
helm push ${DIST_FOLDER}/presidio-chart-${VERSION}.tgz oci://ghcr.io/hoophq/helm-charts/
1313

14-
.PHONY: test publish
14+
publish:
15+
./scripts/publish-release.sh
16+
17+
.PHONY: test release publish

scripts/publish-release.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
5+
gh auth status
6+
7+
# pull latest tags from remote
8+
LATEST_TAG=$(gh release list -L 1 |awk {'print $1'})
9+
10+
echo "=> fetching tags from remote ..."
11+
git fetch origin
12+
echo ""
13+
14+
echo "=> Here are the last 10 releases from github"
15+
gh release list -L 10
16+
17+
read -rep $'\nWhich version do you like to release?\n=> ' GIT_TAG
18+
19+
tagRelease(){
20+
git tag $GIT_TAG
21+
git push origin $GIT_TAG
22+
}
23+
24+
read -rep $'=> Do you with to create this tag / release?\n(y/n) => ' choice
25+
case "$choice" in
26+
y|Y ) tagRelease;;
27+
n|N ) echo -e "\naborting ..."; exit 0;;
28+
* ) echo "invalid choice";;
29+
esac

0 commit comments

Comments
 (0)