Skip to content

BigFlow release

BigFlow release #62

Workflow file for this run

name: BigFlow release
on:
workflow_run:
workflows: [ "BigFlow CI" ]
branches: [ master ]
types:
- completed
workflow_dispatch:
jobs:
check_if_version_file_was_changed:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
outputs:
version_changed: ${{ steps.check_file_changed.outputs.version_changed }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Version file check
shell: pwsh
id: check_file_changed
run: |
# Diff HEAD with the previous commit
$diff = git diff --name-only HEAD^ HEAD
# Check if the bigflow/_version.py has changed (added, modified, deleted)
$SourceDiff = $diff | Where-Object { $_ -match 'bigflow/_version.py$' }
$HasDiff = $SourceDiff.Length -gt 0
# Set the output named "version_changed"
"version_changed=$HasDiff" >> $env:GITHUB_OUTPUT
release:
runs-on: ubuntu-latest
needs: [ check_if_version_file_was_changed ]
if: needs.check_if_version_file_was_changed.outputs.version_changed == 'True'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install --upgrade pip wheel setuptools
- name: Build package & upload to pypi
run: |
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/* -u __token__ -p ${{secrets.PYPI_TOKEN}}