From 3ccd6eea0f93077191e38493fda0834e9212b25c Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Tue, 6 Aug 2024 13:17:32 +0000 Subject: [PATCH] refact(github-actions): bump and tag release before publishing --- .github/workflows/pypi-release.yaml | 29 ++++++++++++++++++-- .github/workflows/{deploy.yaml => test.yaml} | 23 +--------------- 2 files changed, 27 insertions(+), 25 deletions(-) rename .github/workflows/{deploy.yaml => test.yaml} (66%) diff --git a/.github/workflows/pypi-release.yaml b/.github/workflows/pypi-release.yaml index d61c05d..94c1236 100644 --- a/.github/workflows/pypi-release.yaml +++ b/.github/workflows/pypi-release.yaml @@ -1,11 +1,34 @@ -name: Publish SqliteCloud 🐍 to PyPI 📦 +name: Publish SQLite Cloud to PyPI on: workflow_dispatch: jobs: + release: + if: ${{ github.ref == 'refs/heads/main' }} + name: Bump version and tag + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + - name: Set version + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + python -m pip install -r requirements-dev.txt + bump2version patch + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + force: true + tags: true + build-n-publish: - name: Build and publish SqliteCloud 🐍 to PyPI 📦 + if: ${{ github.ref == 'refs/heads/main' }} + name: Build and publish SQLite Cloud to PyPI + needs: release runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -35,7 +58,7 @@ jobs: echo "Current Directory: $(pwd)" rm -r src/sqlitecloud.egg-info ls src/ - - name: Publish distribution 📦 to PyPI + - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: src/dist/ diff --git a/.github/workflows/deploy.yaml b/.github/workflows/test.yaml similarity index 66% rename from .github/workflows/deploy.yaml rename to .github/workflows/test.yaml index 88ea316..bccc1b4 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/test.yaml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Test and Release +name: Test on: push: @@ -44,24 +44,3 @@ jobs: uses: codecov/codecov-action@v4.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} - release: - if: ${{ github.ref == 'refs/heads/main' }} - needs: tests - name: Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - - name: Set version - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - python -m pip install -r requirements-dev.txt - bump2version patch - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - force: true - tags: true