Skip to content

Commit

Permalink
fix: fix release CI (#165)
Browse files Browse the repository at this point in the history
* test fix release CI

* test fix release CI

* test fix release CI

* test fix release CI

* test fix release CI

* test fix release CI

* test fix release CI

* test fix release CI

* remove bump2version from release CI

* change code

* split release CI

* format with toml-sort

* change triggers

* Update pyproject.toml

* optimize code

* fix sort-toml error

* merge release & upload

* fix release error

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

* test release ci

---------

Co-authored-by: you-n-g <[email protected]>
  • Loading branch information
SunsetWolf and you-n-g authored Aug 7, 2024
1 parent 5e14fa5 commit 85d6a5e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 51 deletions.
13 changes: 12 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<!--- 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/). -->
<!--- Category: -->
<!--- Patch Updates: `fix:` -->
<!--- Example: fix(auth): correct login validation issue -->
<!--- minor update (introduces new functionality): `feat` -->
<!--- Example: feature(parser): add ability to parse arrays -->
<!--- major update(destructive update): Include BREAKING CHANGE in the commit message footer, or add `! ` in the commit footer to indicate that there is a destructive update. -->
<!--- Example: feat(auth)! : remove support for old authentication method -->
<!--- Other updates: `build:`, `chore:`, `ci:`, `docs:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`. -->

## 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
63 changes: 17 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,22 @@ 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
pip install setuptools wheel twine # better-exceptions(optional for debug)
- name: Release please
id: release_please
uses: googleapis/release-please-action@v4
with:
# 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
- run: env | sort
- run: make dev
- run: make build
- name: upload
if: ${{ steps.release.outputs.release_created }}
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
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
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 }}
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
make upload
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ description = "Research & Development Agent"
dynamic = [
"dependencies",
"optional-dependencies",
"version",
]
keywords = [
"Autonomous Agents",
"Large Language Models",
"Research and Development",
]
license = {text = "MIT License"}
name = "rdagent"
readme = "README.md"
requires-python = ">=3.10"
version = "v0.0.0"

[project.urls]
homepage = "https://github.com/microsoft/RD-Agent/"
Expand Down Expand Up @@ -108,6 +107,8 @@ package = {file = ["requirements/package.txt"]}
test = {file = ["requirements/test.txt"]}

[tool.setuptools_scm]
local_scheme = "no-local-version"
version_scheme = "guess-next-dev"

[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

0 comments on commit 85d6a5e

Please sign in to comment.