diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8ecb01e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +name: Release + +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: 'Type of release' + required: true + options: + - patch + - minor + - major + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install semver + + - name: Determine new version + id: version + run: | + current_version=$(python -c "import uniclip; print(uniclip.__version__)") + new_version=$(python -c "import semver; print(str(semver.VersionInfo.parse('$current_version').bump_${{ github.event.inputs.release_type }}()))") + echo "New version will be: $new_version" + echo "new_version=$new_version" >> $GITHUB_OUTPUT + + - name: Update version + run: | + sed -i "s/__version__ = .*/__version__ = \"${{ steps.version.outputs.new_version }}\"/" uniclip/__init__.py + + - name: Commit version update + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add uniclip/__init__.py + git commit -m "Bump ${{ github.event.inputs.release_type }} version to ${{ steps.version.outputs.new_version }}" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.version.outputs.new_version }} + release_name: Release ${{ steps.version.outputs.new_version }} + draft: false + prerelease: false + + - name: Update README + run: | + sed -i "s/Current version: .*/Current version: ${{ steps.version.outputs.new_version }}/" README.md + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "Update version in README to ${{ steps.version.outputs.new_version }}" + git push \ No newline at end of file diff --git a/README.md b/README.md index ea1911c..3c070e2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Uniclip is a clipboard synchronization tool that allows you to share clipboard content across multiple devices within a group. It provides an easy way to keep your clipboard in sync across different machines, making it perfect for users who frequently work with multiple computers or collaborate in teams. +Current version: 0.1.0 + ## Features - Cross-device clipboard synchronization @@ -76,7 +78,7 @@ To set up the development environment: 1. Clone the repository: ```bash - git clone https://github.com/yourusername/uniclip.git + git clone https://github.com/renxida/uniclip.git cd uniclip ``` @@ -96,6 +98,40 @@ To set up the development environment: python -m unittest discover tests ``` +## Continuous Integration and Deployment + +This project uses GitHub Actions for continuous integration and deployment. We follow semantic versioning (SemVer) for version numbers. + +### Creating a New Release + +To create a new release: + +1. Go to the "Actions" tab in your GitHub repository. +2. Select the "Release" workflow. +3. Click "Run workflow". +4. Choose the type of release: + - `patch`: for backwards-compatible bug fixes + - `minor`: for new backwards-compatible features + - `major`: for changes that break backward compatibility +5. Click "Run workflow". + +This will automatically: +- Determine the next version number based on the current version and the type of release +- Update the version number in `uniclip/__init__.py` +- Create a new commit with the version change +- Push the commit to the repository +- Create a new tag with the version number +- Create a new GitHub release +- Update the version number in this README + +The publish workflow will then automatically trigger, building and publishing the new version to PyPI. + +Note: Only maintainers with the necessary permissions can trigger this workflow and publish releases. + +### Automatic Publishing + +When a new release is created (either manually or through the Release workflow), the Publish workflow automatically builds the package and publishes it to PyPI using the Trusted Publisher mechanism. + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. @@ -106,6 +142,8 @@ Contributions are welcome! Please feel free to submit a Pull Request. 4. Push to the branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request +Please ensure your code adheres to the project's coding standards and includes appropriate tests. + ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. @@ -117,4 +155,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file ## Support -If you encounter any problems or have any questions, please [open an issue](https://github.com/yourusername/uniclip/issues) on GitHub. \ No newline at end of file +If you encounter any problems or have any questions, please [open an issue](https://github.com/renxida/uniclip/issues) on GitHub. \ No newline at end of file