Skip to content

Commit

Permalink
Implement manually triggered Publish Python test Package Github action
Browse files Browse the repository at this point in the history
  • Loading branch information
luis11011 committed May 19, 2023
1 parent 22029c5 commit cb73842
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/python-manually-publish-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Update Version and Publish to Test PyPI

on:
workflow_dispatch:
inputs:
new_version:
description: 'New PyOptimus version (TestPyPI)'
required: true
python_version:
description: 'Python version'
default: '3.10'
required: true

jobs:
update-version-and-create-tag:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ github.event.inputs.python_version }}
uses: actions/setup-python@v2
with:
python-version: '${{ github.event.inputs.python_version }}'

- name: Update version in toml file
run: |
sed -i 's/version\s*=\s*".*"/version = "${{ github.event.inputs.new_version }}"/' pyproject.toml
- name: Commit changes
run: |
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git commit -m "Update version in toml file" pyproject.toml
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

- name: Create tag
run: |
git tag "test-${{ github.event.inputs.new_version }}"
- name: Push tag
run: |
git push origin "test-${{ github.event.inputs.new_version }}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Configure Poetry
run: |
poetry config repositories.pyoptimus https://test.pypi.org/legacy/
poetry config http-basic.pyoptimus ${{ secrets.TEST_PYPI_USERNAME }} ${{ secrets.TEST_PYPI_PASSWORD }}
- name: Build and publish package
run: |
poetry build
poetry publish -r pyoptimus
env:
TEST_PYPI_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TEST_PYPI_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}

0 comments on commit cb73842

Please sign in to comment.