chore: bump version to 0.0.6 #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release and Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'pyproject.toml' | |
| permissions: | |
| contents: write | |
| id-token: write # OIDC for PyPI trusted publishing | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version-changed: ${{ steps.check.outputs.changed }} | |
| new-version: ${{ steps.extract.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if version changed | |
| id: check | |
| run: | | |
| git diff HEAD^ HEAD -- pyproject.toml > diff.txt | |
| if grep -q '^[+-]version = ' diff.txt; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract new version | |
| id: extract | |
| if: steps.check.outputs.changed == 'true' | |
| run: | | |
| VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "New version detected: $VERSION" | |
| release-and-publish: | |
| needs: check-version | |
| if: needs.check-version.outputs.version-changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Run tests | |
| run: uv run pytest tests/ -v | |
| - name: Build package | |
| run: uv build | |
| - name: Create and push tag | |
| env: | |
| VERSION: ${{ needs.check-version.outputs.new-version }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "v${VERSION}" -m "Release v${VERSION}" | |
| git push origin "v${VERSION}" | |
| - name: Create GitHub Release | |
| env: | |
| VERSION: ${{ needs.check-version.outputs.new-version }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "v${VERSION}" \ | |
| --title "Release v${VERSION}" \ | |
| --generate-notes \ | |
| --notes "## 설치 | |
| \`\`\`bash | |
| uv add ureca_document_parser==${VERSION} | |
| \`\`\` | |
| 또는 pip: | |
| \`\`\`bash | |
| pip install ureca_document_parser==${VERSION} | |
| \`\`\` | |
| 📚 [문서](https://ureca-corp.github.io/document_parser/)" | |
| - name: Publish to PyPI | |
| run: uv publish | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |