Skip to content

Commit

Permalink
Update CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Feb 25, 2021
1 parent b73ff1d commit 71d424f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 51 deletions.
59 changes: 44 additions & 15 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,59 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Extract variables from env
id: vars
run: |
echo "GitHub ref ${GITHUB_REF}"
VERSION=`echo "${GITHUB_REF}" | cut -f 3 -d "/"`
echo Version: ${VERSION}
echo "##[set-output name=version;]$(echo ${VERSION})"
- name: Get Release version
uses: actions/github-script@v3
id: version
with:
github-token: "${{secrets.GITHUB_TOKEN}}"
script: |
const result = context.payload.release.tag
console.log(result)
return result
- name: Get Release body
uses: actions/github-script@v3
id: body
with:
github-token: "${{secrets.GITHUB_TOKEN}}"
script: |
const result = context.payload.release.body
console.log(result)
return result
- name: Install dependencies
run: |
python -m pip install -U poetry pip wheel
python -m pip install -U poetry pip wheel logchange
python -m poetry config virtualenvs.create false
python -m poetry install -n
- name: Update changelog
env:
VERSION: "${{ steps.version.outputs.result }}"
NOTES: "${{ steps.body.outputs.result }}"
run: |
echo "${NOTES}" | python -m logchange add ${VERSION}
- name: Bump version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.vars.outputs.version }}
VERSION: "${{ steps.version.outputs.result }}"
run: |
scripts/bump_version.sh
python -m poetry install -n
python -m poetry version "${VERSION}"
sed -i -E "s/^version = .+/version = ${VERSION}/" setup.cfg
- name: Commit changes
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
VERSION: "${{ steps.version.outputs.result }}"
run: |
git config --global user.email "volshebnyi@gmail.com"
git config --global user.name "${GITHUB_ACTOR}"
git add pyproject.toml
git add setup.cfg
git add CHANGELOG.md
git commit -m "Bump version to ${VERSION}"
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/vemel/newversion.git --tags
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/vemel/newversion.git HEAD:main
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_USERNAME: "${{ secrets.PYPI_USERNAME }}"
TWINE_PASSWORD: "${{ secrets.PYPI_PASSWORD }}"
run: |
python -m poetry install -n
poetry build
twine upload --non-interactive dist/*
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[PEP 440 -- Version Identification and Dependency Specification](https://www.python.org/dev/peps/pep-0440/).

## [Unreleased]

## [0.1.5] - 2021-02-25
### Changed
- Added compatibility with Python 3.6.10+
36 changes: 0 additions & 36 deletions scripts/bump_version.sh

This file was deleted.

0 comments on commit 71d424f

Please sign in to comment.