Skip to content

Commit

Permalink
docs: Correct action.yml title and description (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
snorremd authored Nov 7, 2023
1 parent 3840b37 commit 866e5e5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
15 changes: 6 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: 'Turbo Monorepo Release Action'
name: 'Get Last Active Deployment Action'
description: |
Creates a GitHub release from a commit range.
Filters the commit range by two criteria:
1. The commits must match conventional commit format
2. The commits must trigger a turbo build for the workspace
Commit range is start (exclusive) to end (inclusive).
The first commit should be the commit preceding the first commit in the release.
Find the (nth) last active deployment for a given GitHub environment.
The action will complete with empty outputs if no active deployments
are found. The action is useful for instance when you want to find the
SHA of the previous deployment to an environment so you can compute
the diff or commit history between the two deployments.
author: 'Adventure Tech AS'

# Define your inputs here.
Expand Down
47 changes: 47 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# About:
# This is a helper script to tag and push a new release.
# GitHub Actions use release tags to allow users to select a specific version of the action to use.
# This script will do the following:
# 1. Get the latest release tag
# 2. Prompt the user for a new release tag (while displaying the latest release tag, and a regex to validate the new tag)
# 3. Tag the new release
# 4. Push the new tag to the remote

# Usage:
# script/release

# COLORS
OFF='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'

latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")

# if the latest_tag is empty, then there are no tags - let the user know
if [[ -z "$latest_tag" ]]; then
echo -e "No tags found (yet) - continue to create your first tag and push it"
latest_tag="[unknown]"
fi

echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
read -r -p 'New Release Tag (vX.X.X format): ' new_tag

tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$'
if echo "$new_tag" | grep -q -E "$tag_regex"; then
echo -e "Tag: ${BLUE}$new_tag${OFF} is valid"
else
echo -e "Tag: ${BLUE}$new_tag${OFF} is ${RED}not valid${OFF} (must be in vX.X.X format)"
exit 1
fi

git tag -a "$new_tag" -m "$new_tag Release"

echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"

git push --tags

echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
echo -e "${GREEN}DONE${OFF}"

0 comments on commit 866e5e5

Please sign in to comment.