From 4eea05f94dccae8bb9ca41f36f377d80cb79a3e4 Mon Sep 17 00:00:00 2001 From: Meryll Dindin Date: Fri, 5 Jul 2024 09:16:02 -0700 Subject: [PATCH] ci: update run commands and use PR to deploy release --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++------ .github/workflows/sirtuin.yml | 18 ++++++++++++------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe96b55..8b50a8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,23 +24,41 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} - name: Setup poetry - run: curl -sSL https://install.python-poetry.org | python3 - + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Checkout new release branch + run: | + git checkout -b gh/release-${{ inputs.version }} - name: Update version in `pyproject.toml` - run: poetry version ${{ inputs.version }} + run: | + poetry version ${{ inputs.version }} - name: Commit version bump run: | - git config --local user.name "github[bot]" - git config --local user.email "github[bot]@github.com" + git config --global user.name 'GitHub Actions' + git config --global user.email 'actions@github.com' git add pyproject.toml git commit -m "build: bump version to ${{ inputs.version }}" git push origin master + - name: Push changes to release branch + run: | + git push origin gh/release-${{ inputs.version }} + - name: Create release - run: gh release create ${{ inputs.version }} --title ${{ inputs.version }} --notes "Release ${{ inputs.version }}" + run: | + gh release create ${{ inputs.version }} --title ${{ inputs.version }} --notes "Release ${{ inputs.version }}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish to PyPI - run: poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }} + run: | + poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }} + + - name: Create pull request + run: | + gh pr create --title "build: release `${{ inputs.version }}`" --body "Release ${{ inputs.version }}" --base master --head gh/release-${{ inputs.version }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sirtuin.yml b/.github/workflows/sirtuin.yml index 1abc3fa..78ecefa 100644 --- a/.github/workflows/sirtuin.yml +++ b/.github/workflows/sirtuin.yml @@ -30,20 +30,26 @@ jobs: key: sirtuin-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - name: Setup poetry - run: curl -sSL https://install.python-poetry.org | python3 - + run: | + curl -sSL https://install.python-poetry.org | python3 - - name: Install dependencies if: steps.cache-dependencies.outputs.cache-hit != 'true' - run: poetry install --sync --with dev + run: | + poetry install --sync --with dev - name: Run `black` - run: make black + run: | + make black - name: Run `mypy` - run: make mypy + run: | + make mypy - name: Run `ruff` - run: make ruff + run: | + make ruff - name: Run `pytest` - run: make pytest + run: | + make pytest