Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): minor fixes to promote and release actions #1339

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,17 @@ runs:
echo "[DEBUG] - Major version: ${{ inputs.major_version }}"
echo "[DEBUG] - Minor version: ${{ inputs.minor_version }}"
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - Repository name: ${{ inputs.repository_name }}"

if [[ "${{ inputs.repository_name }}" == "standard" ]]; then
ROOT_REPO_PATH="apt-standard-${{ inputs.major_version }}"
else
echo "Invalid repository name: ${{ inputs.repository_name }}"
exit 1
fi

echo "[DEBUG] - Get path of testing DEB packages to promote to stable."
SRC_PATHS=$(jf rt search --include-dirs apt-standard-${{ inputs.major_version }}-testing/pool/${{ inputs.module_name }}/*${{ inputs.major_version }}.${{ inputs.minor_version }}*${{ inputs.distrib }}*.deb | jq -r '.[].path')
SRC_PATHS=$(jf rt search --include-dirs "$ROOT_REPO_PATH-testing/pool/${{ inputs.module_name }}/*${{ inputs.distrib }}*.deb | jq -r '.[].path')

if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
Expand All @@ -129,7 +137,7 @@ runs:
fi

echo "[DEBUG] - Build target path."
TARGET_PATH="apt-standard-${{ inputs.major_version }}-${{ inputs.stability }}/pool/${{ inputs.module_name }}/"
TARGET_PATH="$ROOT_REPO_PATH-${{ inputs.stability }}/pool/${{ inputs.module_name }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"

echo "[DEBUG] - Promoting DEB testing artifacts to stable."
Expand All @@ -138,13 +146,8 @@ runs:
jf rt download $ARTIFACT --flat
done

for ARTIFACT_DL in $(dir|grep -E "*.deb"); do
for ARTIFACT_DL in $(dir -1|grep -E ".+${{ inputs.distrib }}.+\.deb"); do
ARCH=$(echo $ARTIFACT_DL | cut -d '_' -f3 | cut -d '.' -f1)
DISTRIB=$(echo $ARTIFACT_DL | cut -d '_' -f2 | cut -d '-' -f2)
if [[ "${{ inputs.distrib }}" != "$DISTRIB" ]]; then
echo "::error::Distrib [$DISTRIB] from package does not match distrib [${{ inputs.distrib }}] from input, abort promotion."
exit 1
fi
echo "[DEBUG] - Promoting (upload) $ARTIFACT_DL to stable $TARGET_PATH."
jf rt upload "$ARTIFACT_DL" "$TARGET_PATH" --deb "${{ inputs.distrib }}/main/$ARCH" --flat
done
Expand Down
9 changes: 8 additions & 1 deletion .github/actions/release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ runs:
declare -a PREVIOUS_STABLE_TAGS=()
SCOPE_VERSION="COLLECT"
MINOR_VERSION_FILE_PATH=".version"
RELEASE_CLOUD=0

# Get current stable branch name
# If MASTER, use root .version
# Else use branch name
if [[ "${{ inputs.github_ref_name }}" == "master" ]]; then
CURRENT_STABLE_BRANCH_MAJOR_VERSION=$(grep -E "MAJOR" .version | cut -d '=' -f2)
RELEASE_CLOUD=1
else
CURRENT_STABLE_BRANCH_MAJOR_VERSION=$(echo ${{ inputs.github_ref_name }} | cut -d '.' -f1,2)
RELEASE_CLOUD=0
fi
echo "Current stable branch major version: $CURRENT_STABLE_BRANCH_MAJOR_VERSION"

Expand All @@ -54,7 +57,11 @@ runs:
MAJOR_VERSION=$(grep -E "MAJOR" .version | cut -d '=' -f2)
MINOR_VERSION=$(grep -E "MINOR" .version | cut -d '=' -f2)
# Previous stable tags array
PREVIOUS_STABLE_TAGS+=($(git tag -l --sort=-version:refname "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION*" | head -n 1))
if [[ $RELEASE_CLOUD -eq 1 ]]; then
PREVIOUS_STABLE_TAGS+=($(git tag -l --sort=-version:refname "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION.*-*" | head -n 1))
else
PREVIOUS_STABLE_TAGS+=($(git tag -l --sort=-version:refname "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION.*" | grep -E "$component-$CURRENT_STABLE_BRANCH_MAJOR_VERSION.[0-9]+$" | head -n 1))
fi
# New stable tags array
TMP_STABLE_TAGS+=("$component-$MAJOR_VERSION.$MINOR_VERSION")
done
Expand Down