summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorTimothy Edmund Crosley <timothy.crosley@gmail.com>2022-12-13 21:04:17 -0800
committerGitHub <noreply@github.com>2022-12-13 21:04:17 -0800
commit0595e320e85b7992cadec8ec8ffda863f9397c3f (patch)
treef47b894fd892a4bbc6b5f9d1598b7b89a5d84520 /.github
parent7eaab8c3dd4d7eb9d32b64f1d05efb3373812a8c (diff)
parent879ea0065f402f2465b339144c593714dfbc7474 (diff)
downloadisort-0595e320e85b7992cadec8ec8ffda863f9397c3f.tar.gz
Merge pull request #2026 from PyCQA/ci/add-release-workflow
Add release workflow
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/release.yml79
1 files changed, 79 insertions, 0 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..62000862
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,79 @@
+---
+name: Release
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ release:
+ name: Release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out the repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 2
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.11"
+
+ - name: Upgrade pip
+ run: |
+ pip install --constraint=.github/workflows/constraints.txt pip
+ pip --version
+
+ - name: Install Poetry
+ run: |
+ pip install --constraint=.github/workflows/constraints.txt poetry
+ poetry --version
+
+ - name: Check if there is a parent commit
+ id: check-parent-commit
+ run: |
+ echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
+
+ - name: Detect and tag new version
+ id: check-version
+ if: steps.check-parent-commit.outputs.sha
+ uses: salsify/action-detect-and-tag-new-version@v2
+ with:
+ version-command: |
+ bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
+
+ - name: Bump version for developmental release
+ if: "! steps.check-version.outputs.tag"
+ run: |
+ poetry version patch &&
+ version=$(poetry version | awk '{ print $2 }') &&
+ poetry version $version.dev.$(date +%s)
+
+ - name: Build package
+ run: |
+ poetry build --ansi
+
+ - name: Publish package on PyPI
+ if: steps.check-version.outputs.tag
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_TOKEN }}
+
+ - name: Publish package on TestPyPI
+ if: "! steps.check-version.outputs.tag"
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ user: __token__
+ password: ${{ secrets.TEST_PYPI_TOKEN }}
+ repository_url: https://test.pypi.org/legacy/
+
+ - name: Publish the release notes
+ uses: release-drafter/release-drafter@v5
+ with:
+ publish: ${{ steps.check-version.outputs.tag != '' }}
+ tag: ${{ steps.check-version.outputs.tag }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}