diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index fe05823e6..c53dcbbc0 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -5,15 +5,32 @@ name: Upload Python Package on: workflow_dispatch: - release: - types: [published] + push: + branches: + - v1 env: IMAGE_NAME: cloudbees/launchable jobs: + tagpr: + permissions: + actions: write + contents: write + pull-requests: write + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.run-tagpr.outputs.tag }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - id: run-tagpr + uses: Songmu/tagpr@da82ed6743aec90049892070edd5561335904a9e # v1.17.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + pypi: - if: github.event_name != 'release' || startsWith(github.event.release.tag_name, 'v1') + needs: tagpr + if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -50,9 +67,10 @@ jobs: env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} with: - args: "Launchable CLI ${{ github.event.release.tag_name }} is released! ${{ github.event.release.html_url }}" + args: "Launchable CLI ${{ needs.tagpr.outputs.tag }} is released! https://github.com/${{ github.repository }}/releases/tag/${{ needs.tagpr.outputs.tag }}" docker: - if: github.event_name != 'release' || startsWith(github.event.release.tag_name, 'v1') + needs: tagpr + if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch' name: Push Docker image to Docker Hub runs-on: ubuntu-22.04 permissions: @@ -81,7 +99,7 @@ jobs: file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: ${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} + tags: ${{ env.IMAGE_NAME }}:${{ needs.tagpr.outputs.tag }} - name: Generate artifact attestation uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 diff --git a/.tagpr b/.tagpr index a508ee580..830d7a252 100644 --- a/.tagpr +++ b/.tagpr @@ -41,3 +41,4 @@ releaseBranch = v1 versionFile = - changelog = false + fixedMajorVersion = v1 diff --git a/README.md b/README.md index d613e0d4c..f143ee383 100644 --- a/README.md +++ b/README.md @@ -44,17 +44,8 @@ pipenv install --dev some-what-module # How to release -1. Create a new tag for the next release locally - -```sh -git checkout v1 -git pull -git tag v1.xx.yy -git push origin --tags -``` - -2. Create new release on Github, then Github Actions automatically uploads the -module to PyPI. +[tagpr](https://github.com/Songmu/tagpr) creates a release pull request automatically when changes are pushed to the `v1` branch. +Merge the release pull request, then GitHub Actions automatically tags, creates a GitHub Release, and uploads the module to PyPI. ## How to update launchable/jar/exe_deploy.jar