From 8167348a828da564b2a33a9e273075c42c7e3742 Mon Sep 17 00:00:00 2001 From: Aakash Ashok Naik <91958822+naik-aakash@users.noreply.github.com> Date: Mon, 3 Feb 2025 06:38:52 +0100 Subject: [PATCH] Update python-publish.yml --- .github/workflows/python-publish.yml | 66 +++++++--------------------- 1 file changed, 17 insertions(+), 49 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3371229d9..1a25842a5 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -6,61 +6,29 @@ # separate terms of service, privacy policy, and support # documentation. -name: Publish autoplex +name: Deploy Autoplex to PyPI on: - workflow_dispatch: - release: - types: [published] + pull_request: + types: [closed] + branches: + - main jobs: deploy: runs-on: ubuntu-latest - + if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'update-changelog' steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Install dependencies - run: | + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dependencies + run: | pip install build python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@v1.10.3 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - - update-changelog: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Fetch Version Tag & Release Notes - id: get_release_info - run: | - echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV - echo "NOTES<> $GITHUB_ENV - gh release view ${{ github.event.release.tag_name }} --json body -q .body >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Insert Version Tag & Release Notes Below `# Changelog` - run: | - { echo "# Changelog"; echo; echo "## $VERSION"; echo; echo "$NOTES"; echo; tail -n +2 CHANGELOG.md; } > temp.md && mv temp.md CHANGELOG.md - - - name: Create Pull Request to push updated CHANGELOG.md - uses: peter-evans/create-pull-request@v7 + - name: Publish package + uses: pypa/gh-action-pypi-publish@v1.10.3 with: - #token: ${{ secrets.ACTION_SECRET }} - commit-message: update CHANGELOG - title: Update changelog with latest release notes - body: Update CHANGELOG.md to reflect release changes - branch: update-changelog - labels: | - automated pr - delete-branch: true - base: main + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}