From 1ffe1ec5710411f9f93f8d204afc599d6c797b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sat, 4 Dec 2021 11:34:22 +0100 Subject: [PATCH] chore: cleanup Makefile and release worlflow --- .github/workflows/release.yml | 87 +++++++++++------------------------ Makefile | 59 +++++------------------- 2 files changed, 39 insertions(+), 107 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30c9668..d4e0559 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,64 +1,33 @@ name: Release Application on: - push: - tags: ['v*'] + - release jobs: - release: - name: Create release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Setup - run: | - sudo apt update - sudo apt install ruby - sudo gem install ronn - - name: Prepare release - id: prepare_release - run: | - changelog="$(git diff HEAD^ HEAD -- CHANGELOG.md | grep -E '\+[#*]' | sed 's/^+//')" - changelog="${changelog//$'%'/'%25'}" - changelog="${changelog//$'\n'/'%0A'}" - changelog="${changelog//$'\r'/'%0D'}" - echo "::set-output name=changelog::$changelog" - - name: Create release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Version ${{ github.ref }} - draft: true - prerelease: false - body: | - ${{ steps.prepare_release.outputs.changelog }} - - pipy: - name: Release to PyPI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.7' - - name: Setup environment - run: | - sudo apt update - sudo apt install ruby - sudo gem install ronn - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine skyfield numpy tabulate Babel requests - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - make i18n build - twine upload dist/* + pipy: + name: Build and Release to PyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.7' + - name: Setup environment + run: | + sudo apt update + sudo apt install ruby + sudo gem install ronn + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine skyfield numpy tabulate Babel requests + - name: Build package + run: | + make i18n build + - name: Publish to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* diff --git a/Makefile b/Makefile index 13277ea..19d78be 100644 --- a/Makefile +++ b/Makefile @@ -1,64 +1,27 @@ black: pipenv run black kosmorro _kosmorro setup.py -.PHONY: test -test: - export LC_ALL=C.UTF-8; \ - export LANG=C.UTF-8; \ - unset KOSMORRO_LATITUDE; \ - unset KOSMORRO_LONGITUDE; \ - unset KOSMORRO_TIMEZONE; \ - LANG=C pipenv run python3 -m coverage run -m unittest test - -build: manpages +.PHONY: build +build: manpage python3 setup.py sdist bdist_wheel -messages: - pipenv run python setup.py extract_messages --output-file=_kosmorro/locales/messages.pot - -manpages: +.PHONY: manpage +manpage: ronn --roff manpage/kosmorro.1.md ronn --roff manpage/kosmorro.7.md -i18n: - python3 setup.py compile_catalog; \ - -env: - @if [[ "$$RELEASE_NUMBER" == "" ]]; \ - then echo "Missing environment variable: RELEASE_NUMBER."; \ - echo 'Example: export RELEASE_NUMBER="1.0.0" (without the leading "v")'; \ - exit 1; \ - fi - -release: env - @echo -e "\e[1mCreating release with version number \e[36m$$RELEASE_NUMBER\e[0m" - @echo - - sed "s/^__version__ =.*/__version__ = \"$$RELEASE_NUMBER\"/g" _kosmorro/__version__.py > version.py - mv version.py _kosmorro/__version__.py +messages: + pipenv run python setup.py extract_messages --output-file=_kosmorro/locales/messages.pot - pipenv run python setup.py extract_messages --output-file=_kosmorro/locales/messages.pot > /dev/null +i18n: + python3 setup.py compile_catalog +changelog: conventional-changelog -p angular -i CHANGELOG.md -s - sed "0,/\\[\\]/s/\\[\\]/[v$$RELEASE_NUMBER]/g" CHANGELOG.md > /tmp/CHANGELOG.md - sed -e "s/...v)/...v$$RELEASE_NUMBER)/" /tmp/CHANGELOG.md > CHANGELOG.md - rm /tmp/CHANGELOG.md - - @echo - @echo -e "\e[1mRelease \e[36m$$RELEASE_NUMBER\e[39m is ready to commit." - @echo -e "Please review the changes, then invoke \e[33mmake finish-release\e[39m." - -finish-release: env - git add CHANGELOG.md _kosmorro/__version__.py _kosmorro/locales/messages.pot - git commit -m "build: bump version $$RELEASE_NUMBER" - git tag "v$$RELEASE_NUMBER" - git checkout features - git merge master - git checkout master +prepare-release: messages changelog @echo - @echo -e "\e[1mVersion \e[36m$$RELEASE_NUMBER\e[39m successfully tagged!" - @echo -e "Invoke \e[33mgit push origin master features v$$RELEASE_NUMBER\e[39m to finish." + @echo "Before tagging, don't forget to update version number in CHANGELOG" clean: rm -rf build dist kosmorro.egg-info manpage/kosmorro.{1,7}{,.html}