Skip to content

Commit

Permalink
🛸 ci: update release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Jan 11, 2023
1 parent 60a7324 commit 4f70032
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 70 deletions.
75 changes: 7 additions & 68 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ jobs:
git config --global user.email "[email protected]"
${PYTHONDIR}/bin/pip install -UI poetry setuptools
${PYTHONDIR}/bin/poetry install --no-root
${PYTHONDIR}/bin/poetry build -vvv
git config --global --add safe.directory '*'
${PYTHONDIR}/bin/poetry run semantic-release version -v DEBUG \
-D commit_author="github-actions <[email protected]>"
${PYTHONDIR}/bin/poetry run semantic-release version -v DEBUG
${PYTHONDIR}/bin/poetry build -vvv
${PYTHONDIR}/bin/poetry install
${PYTHONDIR}/bin/poetry run pytest -vvv tests/
- name: Archive dist
Expand All @@ -76,24 +75,6 @@ jobs:
with:
python-version: "3.11"
architecture: "x64"
- name: Generate release changelog
run: |
pip install "python-semantic-release==7.32.2"
semantic-release changelog -v DEBUG > RELEASE_CHANGELOG
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
- name: Archive release changelog
uses: actions/upload-artifact@v2
with:
name: changelog
path: |
RELEASE_CHANGELOG
- name: Remove release changelog
run: rm -f RELEASE_CHANGELOG
- name: Python semantic release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GH_PAT }}
release:
runs-on: ubuntu-latest
needs: prepare_release
Expand All @@ -112,51 +93,9 @@ jobs:
- name: Display dist
run: ls -R
working-directory: dist
- name: Capture package version
id: package_version
run: |
tar xvzf dist/*.tar.gz --no-anchored --strip=1 PKG-INFO
VERSION=$(grep "^Version" PKG-INFO | tr -d ' ' | cut -d: -f2)
rm -f PKG-INFO
echo "Package version: $VERSION"
echo "package_version=v$VERSION" >> $GITHUB_ENV
- name: Capture current commit tag
id: git_tag
run: |
TAG_VERSION=$(git tag --points-at HEAD)
echo "Current tag: $TAG_VERSION"
echo "current_tag=$TAG_VERSION" >> $GITHUB_ENV
- name: Capture release version
id: release_version
run: |
pip install "python-semantic-release==7.32.2"
s=$(semantic-release version --noop 2>&1 | grep "Should have bumped from")
RELEASE_VERSION=
if [[ "$s" =~ ^.*to' '(.+?)$ ]]; then
RELEASE_VERSION=${BASH_REMATCH[1]}
fi
echo "release_version=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Download release changelog
uses: actions/download-artifact@v2
if: github.event_name == 'push' && env.release_version != env.package_version
with:
name: changelog
- name: Create release
id: create_release
if: github.event_name == 'push' && env.release_version != env.package_version
uses: softprops/action-gh-release@v1
with:
body_path: RELEASE_CHANGELOG
draft: false
name: Release ${{ env.release_version }}
prerelease: false
tag_name: ${{ env.release_version }}
token: ${{ secrets.GH_PAT }}
- name: Delete RELEASE_CHANGELOG
run: rm -f RELEASE_CHANGELOG
- name: Upload to PyPI
if: github.event_name == 'push' && env.release_version != env.package_version
uses: pypa/gh-action-pypi-publish@master
- name: Python semantic release
uses: relekang/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
github_token: ${{ secrets.GH_PAT }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ memunit = "^0.5.2"
ruff = "^0.0.211"

[tool.semantic_release]
build_command = false
commit_author = "github-actions <[email protected]>"
commit_parser = "semantic_release.history.emoji_parser"
major_emoji = "💥"
minor_emoji = "✨,🎉,🚀,🚧"
patch_emoji = "🚑,🔒,🐛,⚡️,🥅,👽,♿️,💬,🔍,🍎,🐧,🏁,🤖,🍏"
remove_dist = false
upload_to_release = false
upload_to_pypi = false
upload_to_release = true
upload_to_pypi = true
use_textual_changelog_sections = true
version_variable = [
"pyproject.toml:version",
Expand Down

0 comments on commit 4f70032

Please sign in to comment.