Skip to content

Commit

Permalink
Update workflow to add release
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKhalili committed Sep 29, 2024
1 parent 41e5ac1 commit dc1c821
Showing 1 changed file with 39 additions and 26 deletions.
65 changes: 39 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10.10'
python-version: "3.10.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10.10'
python-version: "3.10.10"
- name: Install and configure Poetry
uses: snok/[email protected]
with:
Expand All @@ -43,7 +43,7 @@ jobs:
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install
run: poetry install
- name: Install pytest
run: poetry run pip install pytest
- name: Run tests
Expand All @@ -63,7 +63,7 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10.10'
python-version: "3.10.10"
- name: Run version bump script
run: python scripts/bump.py
- name: Commit changes
Expand All @@ -83,25 +83,38 @@ jobs:
needs: [bump-version]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Pull Latest Changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.10'
- name: Install and configure Poetry
uses: snok/[email protected]
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- run: poetry build
- run: poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Pull Latest Changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10.10"
- name: Install and configure Poetry
uses: snok/[email protected]
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Build package
run: poetry build
- name: Publish to PyPI
run: poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
- name: Get version
id: get_version
run: echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.get_version.outputs.VERSION }} \
--title "Release v${{ steps.get_version.outputs.VERSION }}" \
--generate-notes \
dist/*.whl dist/*.tar.gz

0 comments on commit dc1c821

Please sign in to comment.