TP-39914 | fix

This commit is contained in:
Aman Chaturvedi
2024-03-12 12:09:12 +05:30
parent 7a394b7899
commit c7d9695e21

View File

@@ -72,49 +72,60 @@ jobs:
token: ${{ secrets.MY_REPO_PAT }}
submodules: recursive
persist-credentials: true
- name: Check if tag exists
id: check_tag
run: |
TAG_NAME="${{ needs.generate.outputs.package_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
- name: Create and push tag
if: env.tag_exists == 'false'
run: |
TAG_NAME="${{ needs.generate.outputs.package_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
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }}
- name: Create release tag
run: |
TAG_NAME="${{ needs.generate.outputs.package_version }}"
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/}"
GITHUB_TOKEN: ${{ secrets.MY_REPO_PAT }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.generate.outputs.package_version }}
release_name: ${{ needs.generate.outputs.package_version }} (build ${{ needs.generate.outputs.build_number }}) code push
body: ""
draft: false
prerelease: false
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: Check if tag exists
# id: check_tag
# run: |
# TAG_NAME="${{ needs.generate.outputs.package_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
# - name: Create and push tag
# if: env.tag_exists == 'false'
# run: |
# TAG_NAME="${{ needs.generate.outputs.package_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="${{ needs.generate.outputs.package_version }}"
# 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
# }" \
# "https://api.github.com/repos/$REPO/releases"
# shell: bash