Skip to content

Commit

Permalink
ci: selectively ignoring missing dev versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nishaq503 committed Jan 30, 2024
1 parent fba2ba5 commit baf3c60
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ on:
default: 'image-tools'
workflow_call:
inputs:
repo_name:
description: 'Name of the base repository'
required: true
type: string
num-commits:
description: "The of commits to check for updated packages. If 0, the action will check all commits on the master branch. For any larger value, the action will check the last n commits for any updated packages."
required: true
default: 1
type: number
ignore-missing-dev:
description: "If true, the action will ignore packages that do not have a dev version. Otherwise, the action will fail if any package does not have a dev version."
required: true
default: true
type: boolean
repo_name:
description: 'Name of the base repository'
required: true
type: string
secrets:
DOCKER_USERNAME:
description: 'Docker Hub username'
Expand Down Expand Up @@ -88,10 +93,23 @@ jobs:
python -m pip install --upgrade pip
pip install bump2version
- name: Python | Bump Version Release
id: bump_version
run: |
cd "${{ matrix.package_dir }}"
bump2version release --no-commit
# check if the package has a dev version
if [[ "$(cat VERSION)" != *dev* ]]
then
${{ github.event.inputs.ignore-missing-dev }} && echo "success" ||
echo "::error::${{ matrix.package_dir }} does not have a dev version" && exit 1
else
bump2version release --no-commit
fi
if [[ $(git status --porcelain) ]]
then
echo "released=true" >> $GITHUB_output
- name: Git | Commit
if: steps.bump_version.outputs.released == 'true'
env:
CI_COMMIT_AUTHOR: polusai-auth-helper[bot]
CI_COMMIT_EMAIL: ${{ secrets.APP_ID }}+polusai-auth-helper[bot]@users.noreply.github.com
Expand All @@ -100,6 +118,7 @@ jobs:
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git commit -a -m "build: Bumped release version for ${{ matrix.package_name }}"
- name: Git | Push
if: steps.bump_version.outputs.released == 'true'
uses: ad-m/github-push-action@master
with:
force: true
Expand Down

0 comments on commit baf3c60

Please sign in to comment.