Skip to content

Workflow file for this run

name: Staging Build and Publish
on:
push:
branches:
- 'update-workflow'
# needed to stop endless commit loop by auto-bump
paths-ignore:
- setup.cfg
jobs:
publish:
name: Staging Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
# grep assumes version number is after "version = "
- name: Get Current Version
run: echo -n "current_version=$(grep "version" setup.cfg | cut -d '=' -f2 | tr -d ' \t\n')" >> $GITHUB_ENV
- name: Auto Bump Package Version
uses: FragileTech/bump-version@main
with:
current_version: "${{ env.current_version }}"
files: setup.cfg
part: patch
commit_name: bot-edgepi
commit_email: [email protected]
login: bot-edgepi
token: "${{ secrets.ACTIONS_BOT_TOKEN }}"
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements_build.txt ]; then python -m pip install -r requirements_build.txt; fi
- name: Build Package
run: |
python -m build
- name: Publish Distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Checkout Dev
uses: actions/checkout@v3
with:
ref: dev
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
fetch-depth: 0
- name: Auto Bump Commit SHA
run: |
echo "bump_commit=$(git log -n 1 origin/staging --pretty=format:'%H')" >> $GITHUB_ENV
- name: Cherry Pick
env:
commit_name: bot-edgepi
commit_email: [email protected]
run: |
echo ${{ env.bump_commit }}
git config user.name ${{ env.commit_name }}
git config user.email ${{ env.commit_email }}
git cherry-pick ${{ env.bump_commit }}
git push origin dev