diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..e072609 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,11 @@ +name: Bump version tag on merge + +on: + pull_request: + types: [closed] + branches: [main] + +jobs: + tag: + uses: git-mastery/actions/.github/workflows/bump-version.yml@main + secrets: inherit diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3e03e77..b38f24f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,11 @@ name: Build and release difflib-parser to PyPi on: + workflow_run: + workflows: + - Bump version tag on merge + types: + - completed workflow_dispatch: push: tags: @@ -13,32 +18,13 @@ permissions: issues: read jobs: - publish: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + prepare: + uses: git-mastery/actions/.github/workflows/get-latest-tag.yml@main - - name: Run unit tests - run: | - python -m pytest -s -vv - - - name: Build binary - run: | - echo "__version__ = \"${GITHUB_REF_NAME}\"" > src/difflib_parser/version.py - python -m build - - - name: Publish - run: | - python -m twine upload --username "__token__" --password ${{ secrets.PYPI_TOKEN }} --skip-existing --verbose dist/* + publish: + needs: prepare + uses: git-mastery/actions/.github/workflows/publish-pypi-library.yml@main + with: + library_path: src/difflib_parser + ref_name: ${{ needs.prepare.outputs.ref_name }} + secrets: inherit