From e0ae0da46dfbafd93570dcca1d55c60ec898d024 Mon Sep 17 00:00:00 2001 From: erikhuck Date: Mon, 15 Apr 2024 17:30:46 -0400 Subject: [PATCH 1/2] Adds first version of package_release.yml --- ...ld_documentation.yml => documentation.yml} | 0 .github/workflows/package_release.yml | 34 +++++++++++++++++++ .../workflows/{main.yml => pull_request.yml} | 0 3 files changed, 34 insertions(+) rename .github/workflows/{build_documentation.yml => documentation.yml} (100%) create mode 100644 .github/workflows/package_release.yml rename .github/workflows/{main.yml => pull_request.yml} (100%) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/documentation.yml similarity index 100% rename from .github/workflows/build_documentation.yml rename to .github/workflows/documentation.yml diff --git a/.github/workflows/package_release.yml b/.github/workflows/package_release.yml new file mode 100644 index 0000000..fa57d33 --- /dev/null +++ b/.github/workflows/package_release.yml @@ -0,0 +1,34 @@ +name: Release the Next Version of the Package + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install build + python3 -m pip install twine + - name: Build package + run: python -m build + - name: Check package + run: python3 -m twine check dist/* + - name: Publish package to Test-PyPi + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + - name: Publish package to PyPi + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/pull_request.yml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/pull_request.yml From 02dc0b722b4d4df3108e0bd77a4cfed6be44bfa0 Mon Sep 17 00:00:00 2001 From: erikhuck Date: Mon, 15 Apr 2024 18:11:47 -0400 Subject: [PATCH 2/2] Makes documentation.yml a re-usable workflow --- .github/workflows/documentation.yml | 13 +++---------- .github/workflows/package_release.yml | 3 ++- .github/workflows/pull_request.yml | 8 ++++---- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index d2b0625..3a2da88 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,25 +1,18 @@ -name: Build Documentation +name: Build and Publish Documentation on: - push: - branches: - - main - pull_request: - branches: - - main + workflow_call: jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: fetch-tags: true - name: Set up Python 3.11 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.11' diff --git a/.github/workflows/package_release.yml b/.github/workflows/package_release.yml index fa57d33..1267175 100644 --- a/.github/workflows/package_release.yml +++ b/.github/workflows/package_release.yml @@ -9,9 +9,10 @@ jobs: deploy: runs-on: ubuntu-latest steps: + - uses: ./.github/workflows/documentation.yml - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index aad500f..243ce6c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,4 +1,4 @@ -name: build +name: Pull request on: push: @@ -18,12 +18,12 @@ jobs: runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install testing environment and kegg_pull package + - name: Install testing environment and gpu-tracker package run: bash tests/install.sh - name: Test with pytest run: bash tests/run.sh