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 7b9b99a..9110ba8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,11 @@ name: Build and release repo-smith to PyPi on: + workflow_run: + workflows: + - Bump version tag on merge + types: + - completed workflow_dispatch: push: tags: @@ -13,37 +18,12 @@ 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: Setup Git - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" + prepare: + uses: git-mastery/actions/.github/workflows/get-latest-tag.yml@main - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run unit tests - run: | - python -m pytest -s -vv - - - name: Build binary - run: | - echo "__version__ = \"${GITHUB_REF_NAME}\"" > src/repo_smith/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/repo_smith + ref_name: ${{ needs.prepare.outputs.ref_name }}