Skip to content
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
28 changes: 24 additions & 4 deletions .github/workflows/shared-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel twine

- name: Resolve Branch for the Tagged Commit
id: resolve-branch
if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
run: |
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})

BRANCH_NAME=$(git branch -r --contains $TAG_COMMIT | grep -o 'origin/.*' | sed 's|origin/||' | head -n 1)

if [ -z "$BRANCH_NAME" ]; then
echo "Error: Could not resolve branch for the tag."
exit 1
fi

echo "Resolved Branch Name: $BRANCH_NAME"
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV

- name: Get Previous tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
Expand All @@ -43,23 +59,27 @@ jobs:
fi

- name: Commit changes
if: ${{ inputs.tag == 'internal' || inputs.tag == 'public' }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

if [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
git checkout ${{ env.branch_name }}
fi

git add setup.py
git add skyflow/utils/_version.py

if [ "${{ inputs.tag }}" = "internal" ]; then
if [[ "${{ inputs.tag }}" == "internal" ]]; then
VERSION="${{ steps.previoustag.outputs.tag }}.dev0+$(git rev-parse --short $GITHUB_SHA)"
COMMIT_MESSAGE="[AUTOMATED] Private Release $VERSION"
git commit -m "$COMMIT_MESSAGE"
git push origin ${{ github.ref_name }} -f
fi
if [ "${{ inputs.tag }}" = "public" ]; then
if [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
COMMIT_MESSAGE="[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
git commit -m "$COMMIT_MESSAGE"
git push origin
git push origin ${{ env.branch_name }}
fi

- name: Build and Publish Package
Expand Down
Loading