-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (70 loc) · 2.76 KB
/
merge.yml
File metadata and controls
79 lines (70 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Publish Package
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -U pip
pip install black flake8 pytest twine
pip install --upgrade build
- name: Run linters
run: |
black --check .
flake8 .
- name: Run tests
run: pytest
- name: Generate changelog
uses: mathieudutour/github-tag-action@v6.1
id: tag_and_changelog
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: patch
changelog_sections: |
Features: Features and User Stories
Bug Fixes: Bug Fixes and Hotfixes
Performance Improvements: Performance Improvements
Maintenance: Maintenance and Cleanup
changelog_exclude_labels: ci-*
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_and_changelog.outputs.new_tag }}
name: Release ${{ steps.tag_and_changelog.outputs.new_tag }}
body: ${{ steps.tag_and_changelog.outputs.changelog }}
- name: Update __init__.py and changelog
run: |
echo Patching CHANGELOG.md to ${{ steps.tag_and_changelog.outputs.new_tag }}
echo '${{ steps.tag_and_changelog.outputs.changelog }}' > changelog.md
cat CHANGELOG.md >> changelog.md
mv changelog.md CHANGELOG.md
git add CHANGELOG.md
git config user.name "GitHub Actions"
git config user.email noreply@github.com
git commit -m "ci(changelog): Automated ChangeLog for ${{ steps.tag_and_changelog.outputs.new_tag }}"
echo Patching pyproject.toml to ${{ steps.tag_and_changelog.outputs.new_tag }}
sed -i "s/^version = .*/version = \'${{ steps.tag_and_changelog.outputs.new_tag }}\'/g" pyproject.toml
sed -i "s/__version__ = .*/__version__ = \'${{ steps.tag_and_changelog.outputs.new_tag }}\'/g" schema_change_risk_engine/__init__.py
git add pyproject.toml schema_change_risk_engine/__init__.py
git commit -m "ci: Update pyproject.toml to version ${{ steps.tag_and_changelog.outputs.new_tag }}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run build
run: python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.1
with:
username: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://upload.pypi.org/legacy/