Skip to content

Added some git actions (#496) #1

Added some git actions (#496)

Added some git actions (#496) #1

name: Package Release
on:
push:
branches:
- master
- main
- dev
permissions:
contents: write
jobs:
package-filter:
name: Filter for updated package
uses: ./.github/workflows/package-filter.yml
package-release:
name: Bump release version of updated package
runs-on: ubuntu-latest
needs: package-filter
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install bump2version
run: |
python -m pip install --upgrade pip
pip install bump2version
- name: Get Old Version
id: old_version
run: |
cd "${{ needs.package-filter.outputs.package_dir }}"
if [[ "$(cat VERSION)" != *"dev"* ]]
then
echo "::error::${{ needs.package-filter.outputs.package_name }} does not have a dev version" && exit 1
fi
echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- name: Bump Version
id: bump_version
run: |
cd "${{ needs.package-filter.outputs.package_dir }}"
bump2version release --no-commit
echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- name: Commit and push all changed files
env:
CI_COMMIT_MESSAGE: Bumped version for "${{ needs.package-filter.outputs.package_name }}" from ${{ steps.old_version.outputs.version }} to ${{ steps.bump_version.outputs.version }}
CI_COMMIT_AUTHOR: Continuous Integration
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git commit -a -m "build: ${{ env.CI_COMMIT_MESSAGE }}"
git push