From 8eb57c986936678eea663ddd715d2fc60712b931 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 14 Jun 2024 14:53:05 +0200 Subject: [PATCH 01/10] chore: Set package version --- argilla-v1/src/argilla_v1/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argilla-v1/src/argilla_v1/_version.py b/argilla-v1/src/argilla_v1/_version.py index 0be5545ddf..c677226355 100644 --- a/argilla-v1/src/argilla_v1/_version.py +++ b/argilla-v1/src/argilla_v1/_version.py @@ -13,4 +13,4 @@ # limitations under the License. # coding: utf-8 -version = "1.29.0-alpha.1" +version = "1.29.0-alpha0" From fd7b57bef8546e90ca62e5f624d43e15a4963fa1 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 14 Jun 2024 14:54:18 +0200 Subject: [PATCH 02/10] ci: Prepare argilla-v1 workflow for release --- .github/workflows/argilla-v1.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index 2870c3d149..51fac2bfe1 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -97,6 +97,13 @@ jobs: pip install -U build rm -rf dist && python -m build + - name: Read package info + run: | + PACKAGE_VERSION=$(python -c 'import argilla_v1; print(argilla_v1.__version__)') + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + echo "PACKAGE_NAME=argilla-v1" >> $GITHUB_ENV + echo "$PACKAGE_NAME==$PACKAGE_VERSION" + - name: Upload package artifact uses: actions/upload-artifact@v4 with: @@ -109,7 +116,6 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - if: ${{ github.event_name == 'release' }} needs: - build @@ -136,10 +142,10 @@ jobs: repository_url: https://test.pypi.org/legacy/ - name: Test Installing 🍿 continue-on-error: true - run: pip install --index-url https://test.pypi.org/simple --no-deps argilla==${GITHUB_REF#refs/*/v} - + run: pip install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 uses: pypa/gh-action-pypi-publish@release/v1 + if: ${{ github.event_name == 'release' }} with: user: __token__ password: ${{ secrets.AR_PYPI_API_TOKEN }} From 2f64c60431a164a11db42076400b6879eb6691f6 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 14 Jun 2024 15:19:08 +0200 Subject: [PATCH 03/10] ci: Configure publisher permissions for pypi --- .github/workflows/argilla-v1.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index 51fac2bfe1..5a7f39effe 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -5,9 +5,6 @@ concurrency: cancel-in-progress: true on: - workflow_dispatch: - workflow_call: - push: paths: - argilla-v1/** @@ -116,6 +113,15 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest + # if: ${{ github.event_name == 'release' }} + + permissions: + # This permission is needed for private repositories. + # contents: read + # IMPORTANT: this permission is mandatory for trusted publishing on PyPI + id-token: write + # This permission is needed for creating tags + contents: write needs: - build @@ -137,15 +143,10 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 continue-on-error: true with: - user: __token__ - password: ${{ secrets.AR_TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ - name: Test Installing 🍿 continue-on-error: true run: pip install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 uses: pypa/gh-action-pypi-publish@release/v1 if: ${{ github.event_name == 'release' }} - with: - user: __token__ - password: ${{ secrets.AR_PYPI_API_TOKEN }} From cd80a29b13f6c9efd0d297ececc8d131ed10d91e Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 14 Jun 2024 15:30:39 +0200 Subject: [PATCH 04/10] ci: Read package version before publishing --- .github/workflows/argilla-v1.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index 5a7f39effe..ee1b16e794 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -94,13 +94,6 @@ jobs: pip install -U build rm -rf dist && python -m build - - name: Read package info - run: | - PACKAGE_VERSION=$(python -c 'import argilla_v1; print(argilla_v1.__version__)') - echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV - echo "PACKAGE_NAME=argilla-v1" >> $GITHUB_ENV - echo "$PACKAGE_NAME==$PACKAGE_VERSION" - - name: Upload package artifact uses: actions/upload-artifact@v4 with: @@ -139,6 +132,13 @@ jobs: with: name: argilla-v1 path: dist + - name: Read package info + run: | + pip install --no-deps dist/*.whl + PACKAGE_VERSION=$(python -c 'from importlib.metadata import version; print(version("argilla-v1"))') + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + echo "PACKAGE_NAME=argilla-v1" >> $GITHUB_ENV + echo "$PACKAGE_NAME==$PACKAGE_VERSION" - name: Publish Package to TestPyPI 🥪 uses: pypa/gh-action-pypi-publish@release/v1 continue-on-error: true From b96a9363afacee244696e60e646d22047370f2c7 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 14 Jun 2024 15:50:08 +0200 Subject: [PATCH 05/10] ci: remove unecessary default working directory --- .github/workflows/argilla-v1.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index ee1b16e794..e6e77bf01a 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -119,19 +119,16 @@ jobs: needs: - build - defaults: - run: - shell: bash -l {0} - working-directory: argilla-v1 - steps: - name: Checkout Code 🛎 uses: actions/checkout@v4 + - name: Download python package uses: actions/download-artifact@v4 with: name: argilla-v1 path: dist + - name: Read package info run: | pip install --no-deps dist/*.whl @@ -139,14 +136,17 @@ jobs: echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV echo "PACKAGE_NAME=argilla-v1" >> $GITHUB_ENV echo "$PACKAGE_NAME==$PACKAGE_VERSION" + - name: Publish Package to TestPyPI 🥪 uses: pypa/gh-action-pypi-publish@release/v1 continue-on-error: true with: repository-url: https://test.pypi.org/legacy/ + - name: Test Installing 🍿 continue-on-error: true run: pip install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION + - name: Publish Package to PyPI 🥩 uses: pypa/gh-action-pypi-publish@release/v1 if: ${{ github.event_name == 'release' }} From 8cff79c74a4ec5c3f2a6bf665147d350ccfaf84e Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 14 Jun 2024 16:01:50 +0200 Subject: [PATCH 06/10] ci: Force reinstall package from test.pypi --- .github/workflows/argilla-v1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index e6e77bf01a..459d554de4 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -145,7 +145,7 @@ jobs: - name: Test Installing 🍿 continue-on-error: true - run: pip install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION + run: pip install --upgrade --no-deps --force-reinstall --index-url https://test.pypi.org/simple $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 uses: pypa/gh-action-pypi-publish@release/v1 From 74ef8c05f8398c2976673704480cabadd5371f56 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 17 Jun 2024 11:17:54 +0200 Subject: [PATCH 07/10] chore: Define stable branch trigger --- .github/workflows/argilla-v1.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index d057c232ba..55f6a9acb3 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -13,6 +13,7 @@ on: - develop - feat/** - releases/** + - stable # This is for tests purposes pull_request: paths: @@ -99,7 +100,6 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - # if: ${{ github.event_name == 'release' }} permissions: # This permission is needed for private repositories. @@ -130,6 +130,14 @@ jobs: echo "PACKAGE_NAME=argilla-v1" >> $GITHUB_ENV echo "$PACKAGE_NAME==$PACKAGE_VERSION" + - name: Create tag + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + TAG=${{ env.PACKAGE_NAME }}.v${{ env.PACKAGE_VERSION }} + git tag -f -a $TAG -m "Release ${{ env.PACKAGE_NAME }} v${{ env.PACKAGE_VERSION }}" + git push -f origin $TAG + - name: Publish Package to TestPyPI 🥪 uses: pypa/gh-action-pypi-publish@release/v1 continue-on-error: true @@ -142,4 +150,4 @@ jobs: - name: Publish Package to PyPI 🥩 uses: pypa/gh-action-pypi-publish@release/v1 - if: ${{ github.event_name == 'release' }} + if: github.ref == 'refs/heads/stable' From 26b193fdaa7a473cb9e5b1bd609348623e0625d4 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 17 Jun 2024 11:40:08 +0200 Subject: [PATCH 08/10] ci: run release job also manually only for tests.pypi --- .github/workflows/argilla-v1.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index 55f6a9acb3..c667ea41c4 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -5,6 +5,8 @@ concurrency: cancel-in-progress: true on: + workflow_dispatch: + push: paths: - argilla-v1/** @@ -100,6 +102,7 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest + if: github.ref == 'refs/heads/stable' || ${{ github.event_name }} == 'workflow_dispatch' permissions: # This permission is needed for private repositories. @@ -126,18 +129,11 @@ jobs: run: | pip install --no-deps dist/*.whl PACKAGE_VERSION=$(python -c 'from importlib.metadata import version; print(version("argilla-v1"))') + PACKAGE_NAME=argilla-v1 echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV - echo "PACKAGE_NAME=argilla-v1" >> $GITHUB_ENV + echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV echo "$PACKAGE_NAME==$PACKAGE_VERSION" - - name: Create tag - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - TAG=${{ env.PACKAGE_NAME }}.v${{ env.PACKAGE_VERSION }} - git tag -f -a $TAG -m "Release ${{ env.PACKAGE_NAME }} v${{ env.PACKAGE_VERSION }}" - git push -f origin $TAG - - name: Publish Package to TestPyPI 🥪 uses: pypa/gh-action-pypi-publish@release/v1 continue-on-error: true @@ -149,5 +145,13 @@ jobs: run: pip install --upgrade --no-deps --force-reinstall --index-url https://test.pypi.org/simple $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 - uses: pypa/gh-action-pypi-publish@release/v1 if: github.ref == 'refs/heads/stable' + uses: pypa/gh-action-pypi-publish@release/v1 + + - name: Create tag + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + TAG=${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }} + git tag -f -a $TAG -m "Release ${{ env.PACKAGE_NAME }} v${{ env.PACKAGE_VERSION }}" + git push -f origin $TAG From e7d6f6306a2814dfba2a80f8e62e400e5e2d0a90 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 17 Jun 2024 11:42:54 +0200 Subject: [PATCH 09/10] chore: Rename stable release name --- .github/workflows/argilla-v1.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index c667ea41c4..2a1b01caf7 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -15,7 +15,7 @@ on: - develop - feat/** - releases/** - - stable # This is for tests purposes + - releases/stable # This is for tests purposes pull_request: paths: @@ -102,7 +102,7 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - if: github.ref == 'refs/heads/stable' || ${{ github.event_name }} == 'workflow_dispatch' + if: github.ref == 'refs/heads/releases/stable' || ${{ github.event_name }} == 'workflow_dispatch' permissions: # This permission is needed for private repositories. @@ -145,7 +145,7 @@ jobs: run: pip install --upgrade --no-deps --force-reinstall --index-url https://test.pypi.org/simple $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 - if: github.ref == 'refs/heads/stable' + if: github.ref == 'refs/heads/releases/stable' uses: pypa/gh-action-pypi-publish@release/v1 - name: Create tag From 0b46f0da261a4ea3c0ab09870b2a299222b973b9 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 17 Jun 2024 13:21:17 +0200 Subject: [PATCH 10/10] ci: Set stable branch to main and remove tag creation --- .github/workflows/argilla-v1.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index 2a1b01caf7..f2b3e7dd76 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -15,7 +15,6 @@ on: - develop - feat/** - releases/** - - releases/stable # This is for tests purposes pull_request: paths: @@ -102,7 +101,7 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - if: github.ref == 'refs/heads/releases/stable' || ${{ github.event_name }} == 'workflow_dispatch' + if: github.ref == 'refs/heads/main' || ${{ github.event_name }} == 'workflow_dispatch' permissions: # This permission is needed for private repositories. @@ -145,13 +144,5 @@ jobs: run: pip install --upgrade --no-deps --force-reinstall --index-url https://test.pypi.org/simple $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 - if: github.ref == 'refs/heads/releases/stable' + if: github.ref == 'refs/heads/main' uses: pypa/gh-action-pypi-publish@release/v1 - - - name: Create tag - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - TAG=${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }} - git tag -f -a $TAG -m "Release ${{ env.PACKAGE_NAME }} v${{ env.PACKAGE_VERSION }}" - git push -f origin $TAG