From e6e89454e9d6e5e42ac6369c547bb8104bbe3790 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Thu, 16 Jan 2025 15:02:37 +0530 Subject: [PATCH 1/2] SK-1821: Refactor release pipelines --- .github/workflows/beta-release.yml | 3 ++ .github/workflows/shared-build-and-deploy.yml | 28 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 7ad03858..540d3e43 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -9,6 +9,9 @@ on: - "*.md" - "skyflow/utils/_version.py" +permissions: + contents: write + jobs: build-and-deploy: uses: ./.github/workflows/shared-build-and-deploy.yml diff --git a/.github/workflows/shared-build-and-deploy.yml b/.github/workflows/shared-build-and-deploy.yml index 7d94b14f..1b0309dd 100644 --- a/.github/workflows/shared-build-and-deploy.yml +++ b/.github/workflows/shared-build-and-deploy.yml @@ -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 @@ -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 From 9219c2ba0bbaff14e76fecad6f328947d1a0cd8c Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Thu, 16 Jan 2025 16:04:54 +0530 Subject: [PATCH 2/2] SK-1821: Updated beta release workflow --- .github/workflows/beta-release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 540d3e43..7ad03858 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -9,9 +9,6 @@ on: - "*.md" - "skyflow/utils/_version.py" -permissions: - contents: write - jobs: build-and-deploy: uses: ./.github/workflows/shared-build-and-deploy.yml