From b8cf086d4dd858a50a3e3462d2e4dc0fd57dae60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:29:41 +0100 Subject: [PATCH 1/6] Update release.yaml --- .github/workflows/release.yaml | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8b137891..31666175 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1 +1,71 @@ +name: Release +on: + pull_request: + types: + - closed + +jobs: + set-package-matrix: + # This action returns all sub-packages to be published, except the `thousandeyes-sdk-core`. + # It thens exports the variable to matrix, so that the deployment job is run individually for each sub-package + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.packages.outputs.packages }} + steps: + - uses: actions/checkout@v4 + - id: packages + run: | + FOLDERS_JSON=$(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" ! -name "thousandeyes-sdk-core"| cut -c 3- | jq -R -s -c 'split("\n")[:-1]') + echo "packages=$FOLDERS_JSON" >> "$GITHUB_OUTPUT" + deployment: + if: github.event.pull_request.merged == true + needs: set-package-matrix + strategy: + matrix: + package-name: ${{ fromJSON(needs.set-package-matrix.outputs.packages) }} + runs-on: ubuntu-latest + permissions: + id-token: write + environment: + name: test + url: https://pypi.org/p/${{ matrix.package-name }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: pip + cache-dependency-path: '**/pyproject.toml' + - name: Install dependencies + run: | + pip install setuptools wheel build + - name: Build + run: | + cp .version ${{ matrix.package-name }}/ + python -m build ${{ matrix.package-name }} --outdir dist/ + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + bump-version: + needs: deployment + name: Bump version and commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: pip + python-version: '3.11' + - name: Install bumpversion + env: + GITHUB_TOKEN: ${{ secrets.PAT_BYPASS }} + run: | + git config user.name "API Team" + git config user.email "api-team@thousandeyes.com" + + pip install bumpversion + bumpversion minor --commit + git push --force From 803d6ebf3e3136d3db05777b08ceee4dc94c8375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:44:18 +0100 Subject: [PATCH 2/6] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 31666175..e4d39840 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,7 +27,7 @@ jobs: permissions: id-token: write environment: - name: test + name: release url: https://pypi.org/p/${{ matrix.package-name }} steps: - uses: actions/checkout@v4 From cb1da4e18657974e4e9b9450d6262234806c03ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:52:14 +0100 Subject: [PATCH 3/6] Update release.yaml --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e4d39840..00417cbe 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,7 +6,7 @@ on: jobs: set-package-matrix: - # This action returns all sub-packages to be published, except the `thousandeyes-sdk-core`. + # This action returns all sub-packages to be published. # It thens exports the variable to matrix, so that the deployment job is run individually for each sub-package runs-on: ubuntu-latest outputs: @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - id: packages run: | - FOLDERS_JSON=$(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" ! -name "thousandeyes-sdk-core"| cut -c 3- | jq -R -s -c 'split("\n")[:-1]') + FOLDERS_JSON=$(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" | cut -c 3- | jq -R -s -c 'split("\n")[:-1]') echo "packages=$FOLDERS_JSON" >> "$GITHUB_OUTPUT" deployment: if: github.event.pull_request.merged == true From c9312b6299447fd8fb902928fcdda382d9e3bb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:14:08 +0100 Subject: [PATCH 4/6] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 00417cbe..165aa36d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -41,7 +41,7 @@ jobs: pip install setuptools wheel build - name: Build run: | - cp .version ${{ matrix.package-name }}/ + cp .version LICENSE NOTICE ${{ matrix.package-name }}/ python -m build ${{ matrix.package-name }} --outdir dist/ - name: Publish uses: pypa/gh-action-pypi-publish@release/v1 From 692756edee0f7d697c0235a31c1c3deb8fa9f489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:31:44 +0100 Subject: [PATCH 5/6] Update release.yaml --- .github/workflows/release.yaml | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 165aa36d..f4767c0a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,8 +1,8 @@ name: Release on: - pull_request: - types: - - closed + push: + tags: + - '*' jobs: set-package-matrix: @@ -41,31 +41,11 @@ jobs: pip install setuptools wheel build - name: Build run: | + echo $GITHUB_REF_NAME >> ${{ matrix.package-name }}/.version cp .version LICENSE NOTICE ${{ matrix.package-name }}/ python -m build ${{ matrix.package-name }} --outdir dist/ - name: Publish uses: pypa/gh-action-pypi-publish@release/v1 with: skip-existing: true - bump-version: - needs: deployment - name: Bump version and commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - cache: pip - python-version: '3.11' - - name: Install bumpversion - env: - GITHUB_TOKEN: ${{ secrets.PAT_BYPASS }} - run: | - git config user.name "API Team" - git config user.email "api-team@thousandeyes.com" - - pip install bumpversion - bumpversion minor --commit - git push --force From b22ef8b930bffac81c130bbd40064c6f3ae3f212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:44:29 +0100 Subject: [PATCH 6/6] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f4767c0a..8d20ebed 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -42,7 +42,7 @@ jobs: - name: Build run: | echo $GITHUB_REF_NAME >> ${{ matrix.package-name }}/.version - cp .version LICENSE NOTICE ${{ matrix.package-name }}/ + cp LICENSE NOTICE ${{ matrix.package-name }}/ python -m build ${{ matrix.package-name }} --outdir dist/ - name: Publish uses: pypa/gh-action-pypi-publish@release/v1