Skip to content

Commit

Permalink
RESET ME: test create stable jira version
Browse files Browse the repository at this point in the history
  • Loading branch information
tuntoja committed Jun 20, 2024
1 parent 1650622 commit 041030f
Showing 1 changed file with 87 additions and 87 deletions.
174 changes: 87 additions & 87 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,68 +99,68 @@ runs:
echo "SCOPE_VERSION=$SCOPE_VERSION" >> "$GITHUB_ENV"
shell: bash

- name: Add new release tags to stable branch
run: |
set -eux
# - name: Add new release tags to stable branch
# run: |
# set -eux

# Add new stable tags to stable branch
echo "Configuring git."
git config --global user.email "[email protected]"
git config --global user.name "Centreon"
# # Add new stable tags to stable branch
# echo "Configuring git."
# git config --global user.email "[email protected]"
# git config --global user.name "Centreon"

# Create release tags on git for each release components
# Abort if no tags or existing tag
echo "Creating release tags."
for TAG in ${NEW_STABLE_TAGS[@]}; do
if [ -z $(git tag --list "$TAG" | head -n 1) ] && [ -n $TAG ]; then
git tag -a "$TAG" -m "$TAG"
git push --follow-tags
echo "::notice::Tagging stable branch with $TAG."
else
echo "::error::Release tag $TAG already exists, exiting."
#exit 1
fi
done
shell: bash
# # Create release tags on git for each release components
# # Abort if no tags or existing tag
# echo "Creating release tags."
# for TAG in ${NEW_STABLE_TAGS[@]}; do
# if [ -z $(git tag --list "$TAG" | head -n 1) ] && [ -n $TAG ]; then
# git tag -a "$TAG" -m "$TAG"
# git push --follow-tags
# echo "::notice::Tagging stable branch with $TAG."
# else
# echo "::error::Release tag $TAG already exists, exiting."
# #exit 1
# fi
# done
# shell: bash

- name: Create GITHUB releases from new release tags
run: |
set -eux
# - name: Create GITHUB releases from new release tags
# run: |
# set -eux

# Install gh cli
echo "Installing GH CLI."
if ! command -v gh &> /dev/null; then
echo "Installing GH CLI."
type -p curl >/dev/null || (sudo apt-get update && sudo apt-get install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt-get update
sudo apt-get install gh -y
else
echo "GH CLI is already installed."
fi
# # Install gh cli
# echo "Installing GH CLI."
# if ! command -v gh &> /dev/null; then
# echo "Installing GH CLI."
# type -p curl >/dev/null || (sudo apt-get update && sudo apt-get install curl -y)
# curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
# sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
# sudo apt-get update
# sudo apt-get install gh -y
# else
# echo "GH CLI is already installed."
# fi

# Rebuild NEW_STABLE_TAGS as an array
# for i in ${NEW_STABLE_TAGS[@]}; do
# NEW_RELEASE_TAGS+=("$i")
# done
# # Rebuild NEW_STABLE_TAGS as an array
# # for i in ${NEW_STABLE_TAGS[@]}; do
# # NEW_RELEASE_TAGS+=("$i")
# # done

# Create GITHUB release for each release components
# Abort if no tags
echo "Creating GITHUB releases."
for TAG in ${NEW_STABLE_TAGS[@]}; do
if [ -n $TAG ]; then
echo "Creating GITHUB release with title $TAG for tag $TAG."
gh release create $TAG --target "${{ inputs.github_ref_name }}" --title "$TAG" --verify-tag
else
echo "::error::Release tag $TAG was empty, exiting."
exit 1
fi
done
shell: bash
env:
GH_TOKEN: ${{ github.token }}
# # Create GITHUB release for each release components
# # Abort if no tags
# echo "Creating GITHUB releases."
# for TAG in ${NEW_STABLE_TAGS[@]}; do
# if [ -n $TAG ]; then
# echo "Creating GITHUB release with title $TAG for tag $TAG."
# gh release create $TAG --target "${{ inputs.github_ref_name }}" --title "$TAG" --verify-tag
# else
# echo "::error::Release tag $TAG was empty, exiting."
# exit 1
# fi
# done
# shell: bash
# env:
# GH_TOKEN: ${{ github.token }}

- name: Create stable JIRA versions from new release tags
run: |
Expand Down Expand Up @@ -217,41 +217,41 @@ runs:
done
shell: bash

- name: Trigger release communication for new releases
run: |
set -eux
# - name: Trigger release communication for new releases
# run: |
# set -eux

MAJOR_VERSION=$CURRENT_STABLE_BRANCH_MAJOR_VERSION
# MAJOR_VERSION=$CURRENT_STABLE_BRANCH_MAJOR_VERSION

# Webhook url
JIRA_INCOMING_WEBHOOK="${{ inputs.jira_webhook_url }}"
# # Webhook url
# JIRA_INCOMING_WEBHOOK="${{ inputs.jira_webhook_url }}"

# Rebuild NEW_STABLE_TAGS as an array (required to build a proper json)
for i in ${NEW_STABLE_TAGS[@]}; do
if [ -n "$i" ]; then
NEW_RELEASE_TAGS+=("$i")
else
echo "::error::Release tag $i was empty, exiting."
exit 1
fi
done
# # Rebuild NEW_STABLE_TAGS as an array (required to build a proper json)
# for i in ${NEW_STABLE_TAGS[@]}; do
# if [ -n "$i" ]; then
# NEW_RELEASE_TAGS+=("$i")
# else
# echo "::error::Release tag $i was empty, exiting."
# exit 1
# fi
# done

# Build JSON structure with released versions
JSON_TAGS=$(jq -n '{componentList:$ARGS.positional}' --args "${NEW_STABLE_TAGS[@]}")
JSON_VERSION_INFO=$(jq -n --arg majorVersion "$MAJOR_VERSION" --arg scopeVersion "$SCOPE_VERSION" '$ARGS.named' )
RELEASE_JSON=$(echo "$JSON_VERSION_INFO" | jq -c --argjson json_tags "$JSON_TAGS" '. += $json_tags')
# # Build JSON structure with released versions
# JSON_TAGS=$(jq -n '{componentList:$ARGS.positional}' --args "${NEW_STABLE_TAGS[@]}")
# JSON_VERSION_INFO=$(jq -n --arg majorVersion "$MAJOR_VERSION" --arg scopeVersion "$SCOPE_VERSION" '$ARGS.named' )
# RELEASE_JSON=$(echo "$JSON_VERSION_INFO" | jq -c --argjson json_tags "$JSON_TAGS" '. += $json_tags')

# DEBUG
echo "JSON_TAGS: \r\n$JSON_TAGS"
echo "JSON_VERSION_INFO: $JSON_VERSION_INFO"
echo "Sending to JIRA automation: \r\n$RELEASE_JSON"
# # DEBUG
# echo "JSON_TAGS: \r\n$JSON_TAGS"
# echo "JSON_VERSION_INFO: $JSON_VERSION_INFO"
# echo "Sending to JIRA automation: \r\n$RELEASE_JSON"

# Call jira webhook to trigger the communication workflow
# and provide versions data for communication
curl \
"$JIRA_INCOMING_WEBHOOK" \
-X POST \
-H 'Content-type: application/json' \
--data "$RELEASE_JSON"
# # Call jira webhook to trigger the communication workflow
# # and provide versions data for communication
# curl \
# "$JIRA_INCOMING_WEBHOOK" \
# -X POST \
# -H 'Content-type: application/json' \
# --data "$RELEASE_JSON"

shell: bash
# shell: bash

0 comments on commit 041030f

Please sign in to comment.