Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix release CI #165

Merged
merged 33 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c8e058f
test fix release CI
SunsetWolf Aug 5, 2024
6e785fa
test fix release CI
SunsetWolf Aug 5, 2024
f2ab3bb
test fix release CI
SunsetWolf Aug 5, 2024
3e00d84
test fix release CI
SunsetWolf Aug 5, 2024
f11563e
test fix release CI
SunsetWolf Aug 5, 2024
c6e277b
test fix release CI
SunsetWolf Aug 5, 2024
7d1a19d
test fix release CI
SunsetWolf Aug 5, 2024
f3c6693
test fix release CI
SunsetWolf Aug 6, 2024
5e214e0
remove bump2version from release CI
SunsetWolf Aug 6, 2024
b6a3d70
change code
SunsetWolf Aug 6, 2024
161d728
split release CI
SunsetWolf Aug 6, 2024
b93ddd7
format with toml-sort
SunsetWolf Aug 6, 2024
2212a39
change triggers
SunsetWolf Aug 6, 2024
2814117
Update pyproject.toml
you-n-g Aug 6, 2024
6a1e11a
optimize code
SunsetWolf Aug 7, 2024
0f585f6
fix sort-toml error
SunsetWolf Aug 7, 2024
1195bfb
merge release & upload
SunsetWolf Aug 7, 2024
f65027f
fix release error
SunsetWolf Aug 7, 2024
72ef879
test release ci
SunsetWolf Aug 7, 2024
fe4a7a7
test release ci
SunsetWolf Aug 7, 2024
f6be1c8
test release ci
SunsetWolf Aug 7, 2024
b0c517e
test release ci
SunsetWolf Aug 7, 2024
a03546a
test release ci
SunsetWolf Aug 7, 2024
e605c13
test release ci
SunsetWolf Aug 7, 2024
af70edc
test release ci
SunsetWolf Aug 7, 2024
33350fc
test release ci
SunsetWolf Aug 7, 2024
3bfbbd8
test release ci
SunsetWolf Aug 7, 2024
2b8aa67
test release ci
SunsetWolf Aug 7, 2024
eea7af1
test release ci
SunsetWolf Aug 7, 2024
ae2950d
test release ci
SunsetWolf Aug 7, 2024
e089bf4
test release ci
SunsetWolf Aug 7, 2024
c136b03
test release ci
SunsetWolf Aug 7, 2024
836e31d
test release ci
SunsetWolf Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--- Thank you for submitting a Pull Request! In order to make our work smoother, please make sure your Pull Request meets the following requirements: 1. Provide a general summary of your changes in the Title above; 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `deps:`, `doc:`, `docs:`, `feat:`, `fix:`, `perf:`, `ref:`, `refactor:`, `revert:`, `style:`, `test:`, `tests:`. -->
<!--- Thank you for submitting a Pull Request! In order to make our work smoother, please make sure your Pull Request meets the following requirements: 1. Provide a general summary of your changes in the Title above; 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `docs:`, `feat:`, `fix:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`(Ref: https://www.conventionalcommits.org/). -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch, minor, major


## Description
<!--- Describe your changes in detail -->
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ on:
- synchronize
push:
branches:
- main
- main
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- name: Check PR Title for Conventional Commit Format
run: |
if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|deps|doc|docs|feat|fix|perf|ref|refactor|revert|style|test|tests|Bump version)(\(\w+\))?!?:\s.*'; then
if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*'; then
echo 'The title does not conform to the Conventional Commit.'
echo 'Please refer to "https://www.conventionalcommits.org/"'
exit 1
Expand Down
58 changes: 11 additions & 47 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
permissions:
contents: read
jobs:
Expand All @@ -23,51 +27,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine bump2version git-changelog # better-exceptions(optional for debug)
- name: Bump version
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
bump2version patch
NEW_VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml)
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
echo "New version: $NEW_VERSION"
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${{ secrets.PRIVATE_KEY }}" >> ~/private_key
chmod 600 ~/private_key
GIT_SSH_COMMAND="ssh -i ~/private_key" git push --follow-tags
- name: Generate changelog
run: |
make changelog
- name: Prepare release notes
run: make release-notes > release-notes.md
- name: Create GitHub release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pip install setuptools wheel twine # better-exceptions(optional for debug)
- name: Release please
uses: googleapis/release-please-action@v4
with:
tag_name: ${{ env.new_version }}
release_name: Release ${{ env.new_version }}
body_path: release-notes.md
prerelease: false
# package:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# cache: pip
# python-version: '3.10'
# - run: env | sort
# - run: make dev
# - run: make build
# - env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: |
# make upload
# The current PAT (personal access token) was created on 2024-08-05,
# since the maximum validity of PAT is 1 year, you need to change the PAT before 2025-08-05.
token: ${{ secrets.PAT }}
release-type: simple
26 changes: 26 additions & 0 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Package and upload to pypi
on:
push:
branches:
- main
jobs:
# package:
# if: |
# startsWith(github.event.pull_request.title, 'chore(main): release')
# needs: release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# cache: pip
# python-version: '3.10'
# - run: env | sort
# - run: make dev
# - run: make build
# - env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: |
# make upload
3 changes: 3 additions & 0 deletions pyproject.toml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove version

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ build-backend = "setuptools.build_meta"
requires = [
"setuptools",
"setuptools-scm",
"wheel",
you-n-g marked this conversation as resolved.
Show resolved Hide resolved
]

[project]
Expand Down Expand Up @@ -108,6 +109,8 @@ package = {file = ["requirements/package.txt"]}
test = {file = ["requirements/test.txt"]}

[tool.setuptools_scm]
local_scheme = "no-local-version"
version_scheme = "post-release"

[tool.tomlsort]
all = true
Expand Down
1 change: 1 addition & 0 deletions requirements/package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
build
setuptools-scm
twine
wheel