Skip to content

Commit

Permalink
adjust flow to get version for tag from the polkadot node_version
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorPopelyaev committed Jul 10, 2024
1 parent 7ee3c14 commit 5820967
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/common/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ get_latest_release_tag() {
printf $latest_release_tag
}

function get_polkadot_nide_version_from_code() {
function get_polkadot_node_version_from_code() {
# list all the files with node version
git grep -e "\(NODE_VERSION[^=]*= \)\".*\"" |
# fetch only the one we need
Expand Down
71 changes: 36 additions & 35 deletions .github/workflows/release-10_rc-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,30 @@ jobs:
with:
fetch-depth: 0

- name: Get release product
id: get_rel_product
shell: bash
run: |
current_branch=$(git branch --show-current)
echo "Current branch: $current_branch"
if [[ "$current_branch" =~ "release-polkadot" ]]; then
echo "product=polkadot" >> $GITHUB_OUTPUT
elif [[ "$current_branch" =~ "release-cumulus" ]]; then
echo "product=polkadot-parachain" >> $GITHUB_OUTPUT
fi
# - name: Get release product
# id: get_rel_product
# shell: bash
# run: |
# current_branch=$(git branch --show-current)
# echo "Current branch: $current_branch"
# if [[ "$current_branch" =~ "release-polkadot" ]]; then
# echo "product=polkadot" >> $GITHUB_OUTPUT
# elif [[ "$current_branch" =~ "release-cumulus" ]]; then
# echo "product=polkadot-parachain" >> $GITHUB_OUTPUT
# fi


- name: Compute next rc tag for polkadot
if: ${{ steps.get_rel_product.outputs.product == 'polkadot' }}
id: compute_tag_polkadot
# if: ${{ steps.get_rel_product.outputs.product == 'polkadot' }}
id: compute_tag
shell: bash
run: |
. ./.github/scripts/common/lib.sh
# Get last rc tag if exists, else set it to {version}-rc1
# TODO: find a way to get latest release tag
version=$(get_version_from_ghref ${GITHUB_REF})
version=$(get_polkadot_node_version_from_code)
#version=$(get_version_from_ghref ${GITHUB_REF})
echo "$version"
echo "version=$version" >> $GITHUB_OUTPUT
Expand All @@ -64,27 +65,27 @@ jobs:
echo "first_rc=true" >> $GITHUB_OUTPUT
fi
- name: Compute next rc tag for polkadot-parachain
if: ${{ steps.get_rel_product.outputs.product == 'polkadot-parachain' }}
id: compute_tag_cumulus
shell: bash
run: |
. ./.github/scripts/common/lib.sh
# - name: Compute next rc tag for polkadot-parachain
# if: ${{ steps.get_rel_product.outputs.product == 'polkadot-parachain' }}
# id: compute_tag_cumulus
# shell: bash
# run: |
# . ./.github/scripts/common/lib.sh

# Get last rc tag if exists, else set it to polkadot-parachains-{version}-rc1
version=$(get_version_from_ghref ${GITHUB_REF})
echo "$version"
echo "version=$version" >> $GITHUB_OUTPUT
# # Get last rc tag if exists, else set it to polkadot-parachains-{version}-rc1
# version=$(get_version_from_ghref ${GITHUB_REF})
# echo "$version"
# echo "version=$version" >> $GITHUB_OUTPUT

last_rc=$(get_latest_rc_tag $version polkadot-parachain)
if [ -n "$last_rc" ]; then
suffix=$(increment_rc_tag $last_rc)
echo "new_tag=polkadot-parachains-$version-rc$suffix" >> $GITHUB_OUTPUT
echo "first_rc=false" >> $GITHUB_OUTPUT
else
echo "new_tag=polkadot-parachain-$version-rc1" >> $GITHUB_OUTPUT
echo "first_rc=true" >> $GITHUB_OUTPUT
fi
# last_rc=$(get_latest_rc_tag $version polkadot-parachain)
# if [ -n "$last_rc" ]; then
# suffix=$(increment_rc_tag $last_rc)
# echo "new_tag=polkadot-parachains-$version-rc$suffix" >> $GITHUB_OUTPUT
# echo "first_rc=false" >> $GITHUB_OUTPUT
# else
# echo "new_tag=polkadot-parachain-$version-rc1" >> $GITHUB_OUTPUT
# echo "first_rc=true" >> $GITHUB_OUTPUT
# fi

- name: Apply new tag
uses: tvdias/github-tagger@ed7350546e3e503b5e942dffd65bc8751a95e49d # v0.0.2
Expand All @@ -93,7 +94,7 @@ jobs:
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# RELEASE_BRANCH_TOKEN requires public_repo OAuth scope
repo-token: "${{ secrets.RELEASE_BRANCH_TOKEN }}"
tag: ${{ steps.compute_tag_polkadot.outputs.new_tag || steps.compute_tag_cumulus.outputs.new_tag }}
tag: ${{ steps.compute_tag.outputs.new_tag }}

# - id: create-issue
# uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1
Expand All @@ -113,4 +114,4 @@ jobs:
access_token: ${{ secrets.RELEASENOTES_MATRIX_V2_ACCESS_TOKEN }}
server: m.parity.io
message: |
Release process for polkadot ${{ steps.compute_tag_polkadot.outputs.new_tag || steps.compute_tag_cumulus.outputs.new_tag }} has been started.<br/>
Release process for polkadot ${{ steps.compute_tag.outputs.new_tag }} has been started.<br/>

0 comments on commit 5820967

Please sign in to comment.