Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Build and Push Tag github action bugs #61

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions .github/workflows/build_and_push_python_codes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Install dependencies
run: |
Expand All @@ -46,16 +47,27 @@ jobs:

- name: Commit changes
run: |
bash -c "if [[ ${{ github.ref }} == 'refs/tags/'* ]]; then export TAG_NAME=${{ github.ref }}; fi"
echo "Tag name: $TAG_NAME"
echo "payload: ${{ github.event.client_payload.tag_name }}"
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG_NAME="${GITHUB_REF#refs/tags/}"
echo "Tag name: $TAG_NAME"
echo "payload: ${{ github.event.client_payload.tag_name }}"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
fi
LAST_COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')
cd destination-repo
git config user.email "[email protected]"
git config user.name "Mohammad Mahdi Malmasi"
LAST_GIT_COMMIT_NAME=$(git log -1 --pretty=format:'%an')
LAST_GIT_COMMIT_EMAIL=$(git log -1 --pretty=format:'%ae')
git config user.name "$LAST_GIT_COMMIT_NAME"
git config user.email "$LAST_GIT_COMMIT_EMAIL"
git add .
git commit -m "Update for tag: $TAG_NAME"
git tag $TAG_NAME
git push --tags
git push origin master
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit. push only new tag."
git tag $TAG_NAME
git push --follow-tags
else
git commit -m "$TAG_NAME | $LAST_COMMIT_MESSAGE"
git tag "$TAG_NAME"
git push --follow-tags
git push origin master
env:
TAG_NAME: ${{ github.event.client_payload.tag_name }}
Loading