TP-39914 | fix

This commit is contained in:
Aman Chaturvedi
2024-03-12 11:30:23 +05:30
parent 14e8f591c0
commit 99ffe14fcb

View File

@@ -42,9 +42,11 @@ jobs:
VERSION=$(node -p "require('./package.json').version")
BUILD_NUMBER=$(node -p "require('./package.json').buildNumber")
echo "version=$VERSION" >> $GITHUB_ENV
echo "Set version to $VERSION"
echo "buildNumber=$BUILD_NUMBER" >> $GITHUB_ENV
- name: Install yarn
run: npm install --global yarn
echo "Set buildNumber to $BUILD_NUMBER"
# - name: Install yarn
# run: npm install --global yarn
# - name: Install appcenter cli
# run: npm install -g appcenter-cli
# - name: Install dependency
@@ -69,47 +71,53 @@ jobs:
token: ${{ secrets.MY_REPO_PAT }}
submodules: recursive
persist-credentials: true
- name: Check if tag exists
id: check_tag
# Added step for debugging
- name: Print environment variables
run: |
TAG_NAME="${{ env.version }}"
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
echo "Version from environment: $version"
echo "Build number from environment: $buildNumber"
- name: Create and push tag
if: env.tag_exists == 'false'
run: |
TAG_NAME="${{ env.version }}"
# 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="${{ env.version }}"
RELEASE_NAME="Release $TAG_NAME"
DESCRIPTION="${{ github.event.inputs.description }}"
REPO="navi-medici/address-verification-app"
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
# - name: Check if tag exists
# id: check_tag
# run: |
# TAG_NAME="${{ env.version }}"
# 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
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\": \"$DESCRIPTION\",
\"draft\": false,
\"prerelease\": false
}" \
"https://api.github.com/repos/$REPO/releases"
shell: bash
# - name: Create and push tag
# if: env.tag_exists == 'false'
# run: |
# TAG_NAME="${{ env.version }}"
# # 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="${{ env.version }}"
# RELEASE_NAME="Release $TAG_NAME"
# 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\": \"$DESCRIPTION\",
# \"draft\": false,
# \"prerelease\": false
# }" \
# "https://api.github.com/repos/$REPO/releases"
# shell: bash