Skip to content

fix: Update workflow.yml #108

fix: Update workflow.yml

fix: Update workflow.yml #108

Workflow file for this run

name: Retrieve and Use Local Version
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: write
id-token: write
actions: write
packages: write
jobs:
release-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine setuptools_scm python-semantic-release
- name: Run semantic-release to determine version
id: determine_version
env:
GH_TOKEN: ${{ secrets.FOSS_GITHUB_TOKEN }}
run: |
VERSION=$(semantic-release version )
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Determined version: $VERSION"
- name: Create and push Git tag
env:
GITHUB_TOKEN: ${{ secrets.FOSS_GITHUB_TOKEN }}
run: |
git config user.name "lakinmindfire"
git config user.email "lakin.mohapatra@mindfiresolutions.com"
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
- name: Push changes to master using a personal access token
env:
GITHUB_TOKEN: ${{ secrets.FOSS_GITHUB_TOKEN }} # Use the PAT from a user with permissions
run: |
git config user.name "lakinmindfire"
git config user.email "lakin.mohapatra@mindfiresolutions.com"
git checkout master
git merge ${{ env.VERSION }} --no-ff
git push origin master
- name: Build package with semantic version
run: |
python setup.py sdist bdist_wheel
- name: Rename dist files with semantic version
run: |
for file in dist/*; do
mv "$file" "${file/.tar.gz/-${{ env.VERSION }}.tar.gz}"
mv "$file" "${file/.whl/-${{ env.VERSION }}.whl}"
done
- name: Publish package to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*