Skip to content

Commit

Permalink
Update build_shared.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ricboer0 authored Nov 15, 2024
1 parent d67182a commit 4351281
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build_shared.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Build and Deploy Shared Libraries

on:
push:
branches:
- main
release:
types: [created]

permissions:
contents: write
Expand Down Expand Up @@ -43,20 +42,27 @@ jobs:
- name: Install GitHub CLI
run: sudo apt-get install gh -y

- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch origin main
git checkout -b update-version-${GITHUB_RUN_ID}
# Check for changes in the DESCRIPTION file
git add r-package/DESCRIPTION
git diff --staged --quiet || git commit --allow-empty -m "Update version to ${{ env.VERSION }}"
if git diff --staged --quiet; then
echo "No changes detected. Skipping branch creation and pull request."
exit 0
fi
# Create a new branch only if there are changes
git checkout -b update-version-${GITHUB_RUN_ID}
git commit -m "Update version to ${{ env.VERSION }}"
git push -u origin update-version-${GITHUB_RUN_ID}
# Create Pull Request
gh pr create --title "Update R Package Version" --body "Auto-update version to ${{ env.VERSION }} by CI/CD." --base main --head update-version-${GITHUB_RUN_ID}
# Automatically approve and merge the PR
# Automatically merge the PR
gh pr merge --auto --squash --delete-branch
build-linux-amd64:
name: Build Linux Shared Library
Expand Down

0 comments on commit 4351281

Please sign in to comment.