| 1 | name: Create release commit |
| 2 | |
| 3 | # This workflow increments versions, tags the version, and pushes it. |
| 4 | # When a tag is pushed, another workflow is triggered that creates a GH release |
| 5 | # and uploads the binaries. This workflow is only for creating the tag. |
| 6 | |
| 7 | # This script will enforce that a minor version is incremented if there are any |
| 8 | # breaking changes since the last minor increment. However, it isn't able to |
| 9 | # differentiate between breaking changes in Node versus Python. If you wish to |
| 10 | # bypass this check, you can manually increment the version and push the tag. |
| 11 | on: |
| 12 | workflow_dispatch: |
| 13 | inputs: |
| 14 | dry_run: |
| 15 | description: 'Dry run (create the local commit/tags but do not push it)' |
| 16 | required: true |
| 17 | default: false |
| 18 | type: boolean |
| 19 | type: |
| 20 | description: 'What kind of release is this?' |
| 21 | required: true |
| 22 | default: 'preview' |
| 23 | type: choice |
| 24 | options: |
| 25 | - preview |
| 26 | - stable |
| 27 | python: |
| 28 | description: 'Make a Python release' |
| 29 | required: true |
| 30 | default: true |
| 31 | type: boolean |
| 32 | other: |
| 33 | description: 'Make a Node/Rust/Java release' |
| 34 | required: true |
| 35 | default: true |
| 36 | type: boolean |
| 37 | bump-minor: |
| 38 | description: 'Bump minor version' |
| 39 | required: true |
| 40 | default: false |
| 41 | type: boolean |
| 42 | |
| 43 | jobs: |
| 44 | make-release: |
| 45 | # Creates tag and GH release. The GH release will trigger the build and release jobs. |
| 46 | runs-on: ubuntu-latest |
| 47 | permissions: |
| 48 | contents: write |
| 49 | steps: |
| 50 | - name: Output Inputs |
| 51 | run: echo "${{ toJSON(github.event.inputs) }}" |
| 52 | - uses: actions/checkout@v4 |
| 53 | with: |
| 54 | fetch-depth: 0 |
| 55 | lfs: true |
| 56 | # It's important we use our token here, as the default token will NOT |
| 57 | # trigger any workflows watching for new tags. See: |
| 58 | # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow |
| 59 | token: ${{ secrets.LANCEDB_RELEASE_TOKEN }} |
| 60 | - name: Set git configs for bumpversion |
| 61 | shell: bash |
| 62 | run: | |
| 63 | git config user.name 'Lance Release' |
| 64 | git config user.email 'lance-dev@lancedb.com' |
| 65 | - name: Set up Python 3.11 |
| 66 | uses: actions/setup-python@v5 |
| 67 | with: |
| 68 | python-version: "3.11" |
| 69 | - name: Bump Python version |
| 70 | if: ${{ inputs.python }} |
| 71 | working-directory: python |
| 72 | env: |
| 73 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | run: | |
| 75 | # Need to get the commit before bumping the version, so we can |
| 76 | # determine if there are breaking changes in the next step as well. |
| 77 | echo "COMMIT_BEFORE_BUMP=$(git rev-parse HEAD)" >> $GITHUB_ENV |
| 78 | |
| 79 | pip install bump-my-version PyGithub packaging |
| 80 | bash ../ci/bump_version.sh ${{ inputs.type }} ${{ inputs.bump-minor }} python-v |
| 81 | - name: Bump Node/Rust version |
| 82 | if: ${{ inputs.other }} |
| 83 | env: |
| 84 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | run: | |
| 86 | pip install bump-my-version PyGithub packaging |
| 87 | bash ci/bump_version.sh ${{ inputs.type }} ${{ inputs.bump-minor }} v $COMMIT_BEFORE_BUMP |
| 88 | - name: Push new version tag |
| 89 | if: ${{ !inputs.dry_run }} |
| 90 | uses: ad-m/github-push-action@master |
| 91 | with: |
| 92 | # Need to use PAT here too to trigger next workflow. See comment above. |
| 93 | github_token: ${{ secrets.LANCEDB_RELEASE_TOKEN }} |
| 94 | branch: ${{ github.ref }} |
| 95 | tags: true |
| 96 | - uses: ./.github/workflows/update_package_lock |
| 97 | if: ${{ !inputs.dry_run && inputs.other }} |
| 98 | with: |
| 99 | github_token: ${{ secrets.GITHUB_TOKEN }} |