Skip to content

Commit f4e1cfd

Browse files
SK-2293 update workflow
1 parent 2c36141 commit f4e1cfd

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Internal Release
2+
3+
on:
4+
push:
5+
tags-ignore:
6+
- '*.*'
7+
paths-ignore:
8+
- "setup.py"
9+
- "*.yml"
10+
- "*.md"
11+
- "skyflow/version.py"
12+
- "samples/**"
13+
branches:
14+
- release/*
15+
16+
jobs:
17+
build-and-deploy:
18+
uses: ./.github/workflows/shared-build-and-deploy.yml
19+
with:
20+
ref: ${{ github.ref_name }}
21+
tag: 'internal'
22+
secrets: inherit
23+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Shared Build and Deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
description: 'Git reference to use (e.g., main or branch name)'
8+
required: true
9+
type: string
10+
11+
tag:
12+
description: 'Release Tag'
13+
required: true
14+
type: string
15+
16+
jobs:
17+
build-and-deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
24+
- uses: actions/setup-python@v2
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install setuptools wheel twine
29+
30+
- name: Resolve Branch for the Tagged Commit
31+
id: resolve-branch
32+
if: ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
33+
run: |
34+
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
35+
36+
BRANCH_NAME=$(git branch -r --contains $TAG_COMMIT | grep -o 'origin/.*' | sed 's|origin/||' | head -n 1)
37+
38+
if [ -z "$BRANCH_NAME" ]; then
39+
echo "Error: Could not resolve branch for the tag."
40+
exit 1
41+
fi
42+
43+
echo "Resolved Branch Name: $BRANCH_NAME"
44+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
45+
46+
- name: Get Previous tag
47+
id: previoustag
48+
uses: WyriHaximus/github-action-get-previous-tag@v1
49+
with:
50+
fallback: 1.0.0
51+
52+
- name: Bump Version
53+
run: |
54+
chmod +x ./ci-scripts/bump_version.sh
55+
if ${{ inputs.tag == 'internal' }}; then
56+
./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
57+
else
58+
./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}"
59+
fi
60+
61+
- name: Commit changes
62+
run: |
63+
git config user.name "${{ github.actor }}"
64+
git config user.email "${{ github.actor }}@users.noreply.github.com"
65+
66+
git add setup.py
67+
git add skyflow/version.py
68+
69+
if [[ "${{ inputs.tag }}" == "internal" ]]; then
70+
VERSION="${{ steps.previoustag.outputs.tag }}.dev0+$(git rev-parse --short $GITHUB_SHA)"
71+
COMMIT_MESSAGE="[AUTOMATED] Private Release $VERSION"
72+
git commit -m "$COMMIT_MESSAGE"
73+
git push origin ${{ github.ref_name }} -f
74+
fi
75+
76+
- name: Build and Publish to JFrog Artifactory
77+
if: ${{ inputs.tag == 'internal' }}
78+
env:
79+
TWINE_USERNAME: ${{ secrets.JFROG_USERNAME }}
80+
TWINE_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
81+
run: |
82+
python setup.py sdist bdist_wheel
83+
twine upload --repository-url https://prekarilabs.jfrog.io/artifactory/api/pypi/skyflow-python/ dist/*

0 commit comments

Comments
 (0)