From bc0d3bd0fa89439a4129355097d1c78b9da0953c Mon Sep 17 00:00:00 2001 From: Jonas Metzener Date: Thu, 21 Apr 2022 11:33:01 +0200 Subject: [PATCH] chore(release): remove automated release --- .github/workflows/pypi.yml | 34 ++++++++++++++++++++++++++ .github/workflows/release.yml | 46 ----------------------------------- CHANGELOG.md | 2 -- MAINTENANCE.md | 22 +++++++++++++---- pyproject.toml | 8 +----- 5 files changed, 52 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/pypi.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..865d629 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,34 @@ +name: PyPI + +on: + release: + types: [created] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - uses: actions/cache@v2 + with: + path: .venv + key: poetry-${{ hashFiles('poetry.lock') }} + restore-keys: | + poetry- + - name: Install dependencies + run: | + python -m pip install -U poetry twine + poetry config virtualenvs.in-project true + poetry install + - name: Build package + run: poetry build + - name: Upload to PyPI + run: twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + TWINE_NON_INTERACTIVE: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ede5550..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Release - -on: - workflow_dispatch: - -concurrency: - group: release - cancel-in-progress: true - -jobs: - release: - name: Release - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - - uses: actions/cache@v2 - with: - path: ~/.venv - key: poetry-${{ hashFiles('poetry.lock') }} - restore-keys: | - poetry- - - - name: Install dependencies - run: | - pip install -U poetry - poetry config virtualenvs.in-project true - poetry install - - - name: Run semantic release - run: | - git config user.name github-actions - git config user.email github-actions@github.com - poetry run semantic-release publish -v DEBUG - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - REPOSITORY_USERNAME: __token__ - REPOSITORY_PASSWORD: ${{ secrets.PYPI_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 490323c..61b6093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,5 @@ # Changelog - - ## v0.5.0 (2022-03-03) ### Breaking diff --git a/MAINTENANCE.md b/MAINTENANCE.md index bbb138c..68f2b70 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -2,9 +2,21 @@ ## Make a new release -We're using `python-semantic-release` to generate a changelog, update the -version and publish it to Github and PyPi. +We're using `python-semantic-release` to generate a changelog and suggest the next version. -To release a new version simply head over to [Github -Actions](https://github.com/adfinis-sygroup/ebau-gwr/actions/workflows/release.yml) -and trigger the workflow dispatch event on the branch `main`. +1. Checkout `main` branch, ensure you have all tags +2. Figure out the next version +3. Update code (CHANGELOG, version info) +4. Pull Request with the version bump. +5. Create tag and release on the merge commit with the changelog + + +```bash +# Ensure you're on the current master and have all release tags +git checkout main +git pull origin --tags +# Figure out the next version +poetry run semantic-release version --noop +# Prepare changelog +poetry run semantic-release changelog --noop --unreleased +``` diff --git a/pyproject.toml b/pyproject.toml index 180a444..1583473 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,14 +114,8 @@ omit = [ show_missing = true [tool.semantic_release] -version_toml = "pyproject.toml:tool.poetry.version" -branch = "main" +version_source = "tag" major_on_zero = false -upload_to_repository = true -upload_to_release = true -build_command = "poetry build" -commit_subject = "chore(release): v{version}" -commit_author = "github-actions " [build-system] requires = ["poetry-core>=1.0.0"]