feat(ci): gha and blacksmith for prs (#4647)
This commit is contained in:
committed by
GitHub
parent
bd8d3a14ff
commit
295f02af6b
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
DOCKER_IMAGE_TAG="speckle/speckle-${SPECKLE_SERVER_PACKAGE}"
|
||||
|
||||
# shellcheck disable=SC2034,SC2086
|
||||
IMAGE_VERSION_TAG="${IMAGE_VERSION_TAG:-${GITHUB_SHA}}"
|
||||
|
||||
# shellcheck disable=SC2068,SC2046
|
||||
LAST_RELEASE="$(git describe --always --tags $(git rev-list --tags) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)" # get the last release tag. FIXME: Fails if a commit is tagged with more than one tag: https://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit/56039163#56039163
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
NEXT_RELEASE="$(echo "${LAST_RELEASE}" | awk -F. -v OFS=. '{$NF += 1 ; print}')"
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
BRANCH_NAME_TRUNCATED="$(echo "${GITHUB_HEAD_REF}" | cut -c -50 | sed 's/[^a-zA-Z0-9.-]/-/g')" # docker has a 128 character tag limit, so ensuring the branch name will be short enough
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
COMMIT_SHA1_TRUNCATED="$(echo "${GITHUB_SHA}" | cut -c -7)"
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SCRIPT_DIR}/common.sh"
|
||||
|
||||
|
||||
if [[ "${GITHUB_REF}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "${GITHUB_REF}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_HEAD_REF}" == "main" ]]; then
|
||||
echo "${NEXT_RELEASE}-alpha.${GITHUB_RUN_ID}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if branch name truncated contains an underscore, we should exit
|
||||
if [[ "${BRANCH_NAME_TRUNCATED}" =~ "_" ]]; then
|
||||
echo "Branch name contains an underscore, exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "${NEXT_RELEASE}-branch.${BRANCH_NAME_TRUNCATED}.${GITHUB_RUN_ID}-${COMMIT_SHA1_TRUNCATED}"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user