auto version bump after github release (#1988)
This commit is contained in:
39
.github/workflows/sdk-release.yml
vendored
39
.github/workflows/sdk-release.yml
vendored
@@ -2,16 +2,49 @@ name: Build Skyvern SDK and publish to PyPI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
release:
|
push:
|
||||||
types: [ published ]
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'pyproject.toml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-version-change:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version_changed: ${{ steps.check.outputs.version_changed }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Check if version changed
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
# Get version from current pyproject.toml
|
||||||
|
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
||||||
|
|
||||||
|
# Get version from previous commit
|
||||||
|
git checkout HEAD^1
|
||||||
|
PREVIOUS_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
||||||
|
|
||||||
|
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
|
||||||
|
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
|
||||||
|
echo "version_changed=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "Version remained at $CURRENT_VERSION"
|
||||||
|
echo "version_changed=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
run-ci:
|
run-ci:
|
||||||
|
needs: check-version-change
|
||||||
|
if: needs.check-version-change.outputs.version_changed == 'true'
|
||||||
uses: ./.github/workflows/ci.yml
|
uses: ./.github/workflows/ci.yml
|
||||||
|
|
||||||
build-sdk:
|
build-sdk:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ run-ci ]
|
needs: [check-version-change, run-ci]
|
||||||
|
if: needs.check-version-change.outputs.version_changed == 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
41
.github/workflows/version-bump.yml
vendored
Normal file
41
.github/workflows/version-bump.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: Version Bump on Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract version from release
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Update version in pyproject.toml
|
||||||
|
run: |
|
||||||
|
sed -i "s/version = \".*\"/version = \"${{ steps.get_version.outputs.version }}\"/" pyproject.toml
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
id: create-pr
|
||||||
|
uses: peter-evans/create-pull-request@v6
|
||||||
|
with:
|
||||||
|
commit-message: "chore: bump version to ${{ steps.get_version.outputs.version }}"
|
||||||
|
title: "chore: bump version to ${{ steps.get_version.outputs.version }}"
|
||||||
|
body: "Auto-generated PR to update version in pyproject.toml"
|
||||||
|
branch: "version-bump/${{ steps.get_version.outputs.version }}"
|
||||||
|
delete-branch: true
|
||||||
|
|
||||||
|
- name: Enable Pull Request Automerge
|
||||||
|
if: steps.create-pr.outputs.pull-request-number
|
||||||
|
run: |
|
||||||
|
gh pr merge --auto --merge "${{ steps.create-pr.outputs.pull-request-number }}"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
Reference in New Issue
Block a user