From 3138a96656d8cf80f983f221901efd888c92e1fe Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Feb 2021 01:09:59 +1300 Subject: [PATCH 1/8] Don't edit setuptools-scm for PyPI releases --- .github/workflows/publish-to-pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 321a8defa49..2ed96937ee9 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -36,6 +36,7 @@ jobs: run: python -m pip install setuptools wheel - name: Fix up version string + if: !startsWith(github.ref, 'refs/tags') run: | # Change setuptools-scm local_scheme to "no-local-version" so the # local part of the version isn't included, making the version string From 82290d66716a097d12c135ad713f2f8f3f8057c9 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:56:26 +1300 Subject: [PATCH 2/8] Move up comment on 'Fix up version string for TestPyPI' step --- .github/workflows/publish-to-pypi.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 2ed96937ee9..f6f41d56ee9 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -35,14 +35,13 @@ jobs: - name: Install dependencies run: python -m pip install setuptools wheel - - name: Fix up version string + - name: Fix up version string for TestPyPI + # This step is only necessary for testing purposes and for TestPyPI if: !startsWith(github.ref, 'refs/tags') run: | # Change setuptools-scm local_scheme to "no-local-version" so the # local part of the version isn't included, making the version string # compatible with PyPI. - # - # The step is only necessary for testing purpose sed --in-place "s/node-and-date/no-local-version/g" setup.py - name: Build source and wheel distributions From 52814b7bb612e2939cc0b539548395b1a0cff08f Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:58:54 +1300 Subject: [PATCH 3/8] Only run the Publish to PyPI workflow on GenericMappingTools/pygmt Disables the Publish to PyPI Github Action on forks of pygmt. --- .github/workflows/publish-to-pypi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index f6f41d56ee9..a13a9ca3ac5 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -19,6 +19,7 @@ jobs: publish-pypi: name: Publish to PyPI runs-on: ubuntu-latest + if: github.repository == 'GenericMappingTools/pygmt' steps: - name: Checkout @@ -35,8 +36,8 @@ jobs: - name: Install dependencies run: python -m pip install setuptools wheel + # This step is only necessary for testing purposes and for TestPyPI - name: Fix up version string for TestPyPI - # This step is only necessary for testing purposes and for TestPyPI if: !startsWith(github.ref, 'refs/tags') run: | # Change setuptools-scm local_scheme to "no-local-version" so the From 0bee4bb5bd938c8b33c7bd2133d1b869b8991a5b Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Feb 2021 23:01:10 +1300 Subject: [PATCH 4/8] Rename secrets from PYPI_PASSWORD to PYPI_API_TOKEN --- .github/workflows/publish-to-pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index a13a9ca3ac5..780f21de8db 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -55,11 +55,11 @@ jobs: - name: Publish to Test PyPI uses: pypa/gh-action-pypi-publish@v1.4.2 with: - password: ${{ secrets.test_pypi_password }} + password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ - name: Publish to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@v1.4.2 with: - password: ${{ secrets.pypi_password }} + password: ${{ secrets.PYPI_API_TOKEN }} From f9dc87187d0169d5a0a94ff51dc8a56bfe6250c8 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Feb 2021 23:25:06 +1300 Subject: [PATCH 5/8] Fix a typo in Publish to PyPI workflow file --- .github/workflows/publish-to-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 780f21de8db..ca4efd9ef64 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -25,7 +25,7 @@ jobs: - name: Checkout uses: actions/checkout@v2.3.4 with: - # fecth all history so that setuptools-scm works + # fetch all history so that setuptools-scm works fetch-depth: 0 - name: Set up Python From 4573a1e7c63f4640e2eb3bbb7c1d2a02af6c6bb3 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Feb 2021 23:29:24 +1300 Subject: [PATCH 6/8] Try fix Github Actions yaml error --- .github/workflows/publish-to-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index ca4efd9ef64..52845cc7e90 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -38,7 +38,7 @@ jobs: # This step is only necessary for testing purposes and for TestPyPI - name: Fix up version string for TestPyPI - if: !startsWith(github.ref, 'refs/tags') + if: ${{ !startsWith(github.ref, 'refs/tags') }} run: | # Change setuptools-scm local_scheme to "no-local-version" so the # local part of the version isn't included, making the version string From 0935a643baedc30d625f2bf2b69186669bc04f19 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 17 Feb 2021 09:46:23 +1300 Subject: [PATCH 7/8] Trigger quick test publishing to TestPyPI --- .github/workflows/publish-to-pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 52845cc7e90..e76309a3d21 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -11,9 +11,9 @@ on: types: - published # Runs for pull requests should be disabled other than for testing purposes - #pull_request: - # branches: - # - master + pull_request: + branches: + - master jobs: publish-pypi: From 3bbd7337bff9a0432c16a1f786939a6fe86a2c33 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 17 Feb 2021 09:46:23 +1300 Subject: [PATCH 8/8] [skip ci] Revert "Trigger quick test publishing to TestPyPI" This reverts commit 0935a643baedc30d625f2bf2b69186669bc04f19. --- .github/workflows/publish-to-pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index e76309a3d21..52845cc7e90 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -11,9 +11,9 @@ on: types: - published # Runs for pull requests should be disabled other than for testing purposes - pull_request: - branches: - - master + #pull_request: + # branches: + # - master jobs: publish-pypi: