diff --git a/.github/workflows/deploy-pypi.yml b/.github/workflows/deploy-pypi.yml deleted file mode 100644 index b6dd87d..0000000 --- a/.github/workflows/deploy-pypi.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Upload Package to pypi - -on: - release: - types: [created] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python -m build - twine upload --verbose --repository testpypi dist/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1359d5e..c963947 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,8 +6,11 @@ on: - main jobs: - deploy: + bump: runs-on: ubuntu-latest + outputs: + tag: ${{ steps.semver.outputs.next }} + steps: - name: Checkout Code uses: actions/checkout@v4 @@ -21,30 +24,35 @@ jobs: token: ${{ github.token }} branch: main - - name: Get previous tag - id: previousTag - run: | - name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1) - echo "previousTag: $name" - echo "previousTag=$name" >> $GITHUB_ENV - - uses: rickstaa/action-create-tag@v1 id: "tag_create" with: tag: ${{ steps.semver.outputs.next }} github_token: ${{ github.token }} - - name: Checkout Code to update tag + release: + runs-on: ubuntu-latest + needs: bump + + steps: + - name: Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Get previous tag + id: previousTag + run: | + name=$(git --no-pager tag --sort=creatordate --merged ${{ needs.bump.outputs.tag }} | tail -2 | head -1) + echo "previousTag: $name" + echo "previousTag=$name" >> $GITHUB_ENV + - name: Update CHANGELOG id: changelog uses: requarks/changelog-action@v1 with: token: ${{ github.token }} - fromTag: ${{ steps.semver.outputs.next }} + fromTag: ${{ needs.bump.outputs.tag }} toTag: ${{ env.previousTag }} - name: Create Release @@ -53,8 +61,8 @@ jobs: allowUpdates: true draft: false makeLatest: true - tag: ${{ steps.semver.outputs.next }} - name: ${{ steps.semver.outputs.next }} + tag: ${{ needs.bump.outputs.tag }} + name: ${{ needs.bump.outputs.tag }} body: ${{ steps.changelog.outputs.changes }} token: ${{ github.token }} @@ -64,3 +72,28 @@ jobs: branch: main commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' file_pattern: CHANGELOG.md + + deploy: + runs-on: ubuntu-latest + needs: release + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python -m build + twine upload --verbose --repository testpypi dist/*