TP-84794 | Release tag fix

This commit is contained in:
yashmantri
2024-09-23 15:38:49 +05:30
parent 9ce4a02050
commit 8ab12cf619
2 changed files with 60 additions and 3 deletions

View File

@@ -110,7 +110,7 @@ jobs:
- name: Check if tag exists
id: check_tag
run: |
TAG_NAME="${{ needs.generate.outputs.package_version }}"
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
EXISTING_TAG=$(git ls-remote --tags origin refs/tags/$TAG_NAME)
if [[ -z "$EXISTING_TAG" ]]; then
echo "Tag $TAG_NAME does not exist."
@@ -123,7 +123,7 @@ jobs:
- name: Create and push tag
if: env.tag_exists == 'false'
run: |
TAG_NAME="${{ needs.generate.outputs.package_version }}"
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
# git config --local user.email "${{ github.actor }}@github.com"
git config --local user.name "${{ github.actor }}"
git tag $TAG_NAME
@@ -132,7 +132,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }}
- name: Create release tag
run: |
TAG_NAME="${{ needs.generate.outputs.package_version }}"
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
BUILD_NUMBER="${{ needs.generate.outputs.build_number }}"
RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push"
DESCRIPTION="${{ github.event.inputs.description }}"

View File

@@ -225,3 +225,60 @@ jobs:
name: source-map
path: index.android.bundle.map
create_release_tag:
needs: generate_source_map
runs-on: [default]
if: success() && (github.event.inputs.environment == 'Prod') && (github.event.inputs.releaseType == 'HARD_RELEASE' || inputs.releaseType == 'HARD_RELEASE') # Only create source map for Prod releases and not for test builds
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.MY_REPO_PAT }}
submodules: recursive
persist-credentials: true
- name: Check if tag exists
id: check_tag
run: |
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
EXISTING_TAG=$(git ls-remote --tags origin refs/tags/$TAG_NAME)
if [[ -z "$EXISTING_TAG" ]]; then
echo "Tag $TAG_NAME does not exist."
echo "tag_exists=false" >> $GITHUB_ENV
else
echo "Tag $TAG_NAME already exists."
echo "tag_exists=true" >> $GITHUB_ENV
fi
- name: Create and push tag
if: env.tag_exists == 'false'
run: |
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
# git config --local user.email "${{ github.actor }}@github.com"
git config --local user.name "${{ github.actor }}"
git tag $TAG_NAME
git push origin $TAG_NAME
env:
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }}
- name: Create release tag
run: |
TAG_NAME="${{github.event.inputs.version_name || inputs.version_name}}"
BUILD_NUMBER="${{ needs.generate.outputs.build_number }}"
RELEASE_NAME="$TAG_NAME (build $BUILD_NUMBER) code push"
DESCRIPTION="${{ github.event.inputs.description }}"
REPO="navi-medici/address-verification-app"
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
curl -X POST \
-H "Authorization: token ${{ secrets.MY_REPO_PAT }}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"$TAG_NAME\",
\"target_commitish\": \"$BRANCH_NAME\",
\"name\": \"$RELEASE_NAME\",
\"body\": \"\",
\"draft\": false,
\"prerelease\": false,
\"generate_release_notes\": true
}" \
"https://api.github.com/repos/$REPO/releases"
shell: bash