openllm

Форк
0
/
create-releases.yml 
215 строк · 8.4 Кб
1
name: release
2
on:
3
  workflow_dispatch:
4
    inputs:
5
      release_type:
6
        description: 'Release type'
7
        required: true
8
        type: choice
9
        default: 'patch'
10
        options:
11
          - major
12
          - minor
13
          - patch
14
defaults:
15
  run:
16
    shell: bash --noprofile --norc -exo pipefail {0}
17
env:
18
  LINES: 120
19
  COLUMNS: 120
20
  OPENLLM_DO_NOT_TRACK: True
21
  PYTHONUNBUFFERED: '1'
22
  HATCH_VERBOSE: 2
23
jobs:
24
  release:
25
    if: github.repository_owner == 'bentoml'
26
    runs-on: ubuntu-latest
27
    permissions:
28
      contents: write
29
      id-token: write
30
    outputs:
31
      version: ${{ steps.version.outputs.version }}
32
    steps:
33
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
34
        with:
35
          fetch-depth: 0
36
          token: ${{ secrets.OPENLLM_PAT }}
37
      - uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
38
        with:
39
          bentoml-version: 'main'
40
          python-version-file: .python-version-default
41
      - name: Import bot's GPG key for signing commits
42
        id: import-gpg
43
        uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # ratchet:crazy-max/ghaction-import-gpg@v6
44
        with:
45
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
46
          passphrase: ${{ secrets.GPG_PASSPHRASE }}
47
          git_config_global: true
48
          git_user_signingkey: true
49
          git_commit_gpgsign: true
50
          git_tag_gpgsign: true
51
      - name: Install jq and curl
52
        run: sudo apt-get install -y jq curl
53
      - name: Create a release
54
        env:
55
          GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
56
          GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
57
          GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
58
          GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
59
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60
        run: |-
61
          pip install ghapi inflection tomlkit orjson
62
          ./.github/actions/release.sh --release ${{ inputs.release_type }}
63
      - name: Set project version
64
        id: version
65
        run: |-
66
          version="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
67
          echo "Release version: $version"
68
          echo "version=$version" >> $GITHUB_OUTPUT
69
  build-pypi:
70
    if: github.repository_owner == 'bentoml'
71
    needs:
72
      - release
73
    name: Compile PyPI distribution for OpenLLM
74
    uses: bentoml/OpenLLM/.github/workflows/build-pypi.yml@main # ratchet:exclude
75
    with:
76
      tags: ${{ needs.release.outputs.version }}
77
  publish-python:
78
    needs:
79
      - build-pypi
80
    runs-on: ubuntu-latest
81
    permissions:
82
      id-token: write
83
    steps:
84
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
85
        with:
86
          ref: '${{ needs.release.outputs.version }}'
87
          token: ${{ secrets.OPENLLM_PAT }}
88
      # NOTE: Keep this section in sync with build-pypi.yml
89
      - name: Download Python artifacts
90
        uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
91
        with:
92
          name: python-artefacts
93
          path: dist
94
      - name: Smoke test compiled artefacts
95
        run: ls -R dist
96
      - name: Publish to PyPI
97
        uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # ratchet:pypa/gh-action-pypi-publish@release/v1
98
        with:
99
          print-hash: true
100
  prepare-next-dev-cycle:
101
    needs:
102
      - release
103
      - publish-python
104
      - binary-distribution
105
    runs-on: ubuntu-latest
106
    permissions:
107
      contents: write
108
      id-token: write
109
    steps:
110
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
111
        with:
112
          fetch-depth: 0
113
      - name: Setup python
114
        uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # ratchet:actions/setup-python@v5.0.0
115
        with:
116
          python-version-file: .python-version-default
117
      - name: Install dependencies
118
        run: pip install hatch towncrier
119
      - name: Install jq and curl
120
        run: sudo apt-get install -y jq curl
121
      - name: Import bot's GPG key for signing commits
122
        id: import-gpg-key
123
        uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # ratchet:crazy-max/ghaction-import-gpg@v6
124
        with:
125
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
126
          passphrase: ${{ secrets.GPG_PASSPHRASE }}
127
          git_config_global: true
128
          git_user_signingkey: true
129
          git_commit_gpgsign: true
130
          git_tag_gpgsign: true
131
      - name: Bump version to dev
132
        env:
133
          GIT_AUTHOR_NAME: ${{ steps.import-gpg-key.outputs.name }}
134
          GIT_AUTHOR_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
135
          GIT_COMMITTER_NAME: ${{ steps.import-gpg-key.outputs.name }}
136
          GIT_COMMITTER_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
137
        run: |
138
          git pull --autostash --no-edit --gpg-sign --ff origin main
139
          SEMVER="${{ needs.release.outputs.version }}"
140
          SEMVER="${SEMVER#v}"
141
          OLD_IFS=$IFS
142
          IFS='.'
143
          read -ra VERSION_BITS <<< "$SEMVER"
144
          IFS=$OLD_IFS
145
          VNUM1=${VERSION_BITS[0]}
146
          VNUM2=${VERSION_BITS[1]}
147
          VNUM3=${VERSION_BITS[2]}
148
          VNUM3=$((VNUM3+1))
149
          DEV_VERSION="$VNUM1.$VNUM2.$VNUM3.dev0"
150
          echo "Bumping version to ${DEV_VERSION}..."
151
          jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
152
          pushd openllm-node &>/dev/null
153
          jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
154
          popd &>/dev/null
155
          git add package.json openllm-node/package.json && git commit -S -sm "infra: bump to dev version of ${DEV_VERSION} [generated] [skip ci]"
156
          git push origin HEAD:main
157
  binary-distribution:
158
    if: github.repository_owner == 'bentoml'
159
    needs: build-pypi
160
    name: Create binary/wheels distribution
161
    uses: bentoml/OpenLLM/.github/workflows/binary-releases.yml@main # ratchet:exclude
162
  release-notes:
163
    if: github.repository_owner == 'bentoml'
164
    needs:
165
      - release
166
      - publish-python
167
      - binary-distribution
168
    name: Create release notes and setup for next cycle
169
    uses: bentoml/OpenLLM/.github/workflows/release-notes.yml@main # ratchet:exclude
170
    with:
171
      tags: ${{ needs.release.outputs.version }}
172
  bump-homebrew-tap:
173
    needs:
174
      - release-notes
175
      - prepare-next-dev-cycle
176
      - release
177
    runs-on: ubuntu-latest
178
    permissions:
179
      contents: write
180
      id-token: write
181
    steps:
182
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
183
        with:
184
          fetch-depth: 0
185
      - uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
186
        with:
187
          bentoml-version: 'main'
188
          python-version-file: .python-version-default
189
      - name: Install jq and curl
190
        run: sudo apt-get install -y jq curl
191
      - name: Import bot's GPG key for signing commits
192
        id: import-gpg-key
193
        uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # ratchet:crazy-max/ghaction-import-gpg@v6
194
        with:
195
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
196
          passphrase: ${{ secrets.GPG_PASSPHRASE }}
197
          git_config_global: true
198
          git_user_signingkey: true
199
          git_commit_gpgsign: true
200
          git_tag_gpgsign: true
201
      - name: Update current formula
202
        env:
203
          GIT_AUTHOR_NAME: ${{ steps.import-gpg-key.outputs.name }}
204
          GIT_AUTHOR_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
205
          GIT_COMMITTER_NAME: ${{ steps.import-gpg-key.outputs.name }}
206
          GIT_COMMITTER_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
207
          GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
208
        run: |
209
          git pull --autostash --no-edit --gpg-sign --ff origin main
210
          SEMVER="${{ needs.release.outputs.version }}"
211
          SEMVER="${SEMVER#v}"
212
          pip install fs jinja2 ghapi plumbum
213
          ./tools/update-brew-tap.py
214
          git add Formula && git commit -S -sm "infra: bump to homebrew tap release to ${SEMVER} [generated] [skip ci]"
215
          git push origin HEAD:main
216

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.