Skip to content

Add workflow to ensure package version has been updated #2

Add workflow to ensure package version has been updated

Add workflow to ensure package version has been updated #2

Workflow file for this run

name: Ensure version has been updated
on:
pull_request:
branches: master
jobs:
target-version:
name: Get package version of target branch
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.base_ref }}
- uses: actions/setup-python@v4
with:
python-version: 3.10
- id: version
run: |
pip install .
echo "version=$(pip show requests | grep "Version:" | cut -d " " -f 2)" >> "$GITHUB_OUTPUT"
new-version:
name: Get package version of pull request branch
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: 3.10
- id: version
run: |
pip install .
echo "version=$(pip show requests | grep "Version:" | cut -d " " -f 2)" >> "$GITHUB_OUTPUT"
check-version:
name: Ensure package version differs from version on target branch
runs-on: ubuntu-latest
needs: [target-version, new-version]
steps:
- env:
TARGET_VERSION: ${{ needs.target-version.outputs.version }}
NEW_VERSION: ${{ needs.new-version.outputs.version }}
run: |
[ "$TARGET_VERSION" != "NEW_VERSION" ]