chenzhaoyang
2025-12-17 d3e5a4b7658ece4f845bbc0c4f95acf3fbdf8a61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: "Release: Pipeline"
 
on:
  release:
    types:
      - released
  workflow_dispatch:
    inputs:
      ref_name:
        description: "Release version X.X.X.postX"
        type: string
        required: true
      release_id:
        description: "GitHub release ID"
        type: string
        required: true
 
concurrency:
  group: ${{ github.workflow }}-${{ inputs.ref_name || github.ref }}
  cancel-in-progress: true
 
env:
  HOMEBREW_TAP_REPO: "homebrew-tap"
 
jobs:
  promote_docker_image:
    name: "Promote"
    permissions:
      contents: read
      checks: read
    uses: ./.github/workflows/docker-release-promote.yml
    with:
      release_tag: ${{ inputs.ref_name || github.ref_name }}
    secrets: inherit
 
  build_hugging_face_docker_image:
    name: "Build Hugging Face docker image"
    needs:
      - promote_docker_image
    uses: ./.github/workflows/docker-build-ontop.yml
    with:
      base_docker_image_version: ${{ inputs.ref_name || github.ref_name }}
      tags: "hf-latest,hf-${{ inputs.ref_name || github.ref_name }}"
      dockerfile_path: Dockerfile.hgface
      ref: ${{ inputs.ref_name || github.ref_name }}
    secrets: inherit
 
  jira_set_fix_version:
    name: "Set Jira fix version"
    needs:
      - promote_docker_image
    runs-on: ubuntu-latest
    steps:
      - uses: hmarr/debug-action@v3.0.0
 
      - name: Checkout Actions Hub
        uses: actions/checkout@v6
        with:
          token: ${{ secrets.GIT_PAT }}
          repository: HumanSignal/actions-hub
          path: ./.github/actions-hub
 
      - name: Set Jira fix version
        uses: ./.github/actions-hub/actions/jira-set-fix-version
        continue-on-error: true
        with:
          jira_server: "${{ vars.JIRA_SERVER }}"
          jira_username: "${{ secrets.JIRA_USERNAME }}"
          jira_token: "${{ secrets.JIRA_TOKEN }}"
          jira_fix_version: "LS OpenSource/${{ inputs.ref_name || github.ref_name }}"
          jira_fix_version_released: true
 
  build-pypi:
    name: "Build"
    permissions:
      contents: write
    uses: ./.github/workflows/build_pypi.yml
    with:
      version: ${{ inputs.ref_name || github.ref_name }}
      ref: ${{ inputs.ref_name || github.ref_name }}
      upload_to_pypi: true
      release-id: ${{ inputs.release_id || github.event.release.id }}
    secrets: inherit
 
  delete-rc-assets:
    name: "Delete Release Candidate Assets"
    runs-on: ubuntu-latest
    needs:
      - build-pypi
    steps:
      - uses: hmarr/debug-action@v3.0.0
 
      - name: Delete Release Candidate Assets
        uses: actions/github-script@v8
        env:
          RELEASE_ID: "${{ inputs.release_id || github.event.release.id }}"
        with:
          github-token: ${{ secrets.GIT_PAT }}
          script: |
            const { repo, owner } = context.repo;
            const release_id = process.env.RELEASE_ID;
            const rc_regexp = /label[-_]studio-\d+.\d+.\d+rc\d+/;
            const {data: release} = await github.rest.repos.getRelease({
              owner,
              repo,
              release_id,
            });
            for (let asset of release.assets) {
              const match = asset.name.match(rc_regexp)
              if (match) {
                console.log(`Deleting asset ${asset.name}`)
                await github.rest.repos.deleteReleaseAsset({
                  owner,
                  repo,
                  asset_id: asset.id,
                });
              }
            }
 
  update-homebrew-tap:
    name: "Update Homebrew Tap"
    runs-on: ubuntu-latest
    needs:
      - build-pypi
    steps:
      - uses: hmarr/debug-action@v3.0.0
 
      - name: DispatchEvent
        uses: actions/github-script@v8
        with:
          github-token: ${{ secrets.GIT_PAT }}
          script: |
            const {repo, owner} = context.repo;
            await github.rest.repos.createDispatchEvent({
              owner: owner,
              repo: '${{ env.HOMEBREW_TAP_REPO }}',
              event_type: 'upstream_formula_update',
              client_payload: {
                formula: 'label-studio',
                version: '${{ inputs.ref_name || github.ref_name }}',
                actor: '${{ github.actor }}',
                url: '${{ needs.build-pypi.outputs.pipy-artifact-url }}',
                sha256: '${{ needs.build-pypi.outputs.pipy-artifact-digests-sha256 }}',
              }
            });
 
  update-helm-chart:
    name: "Update Helm Chart"
    needs:
      - promote_docker_image
    uses: ./.github/workflows/bump-helm-chart.yml
    with:
      docker_image_version: ${{ inputs.ref_name || github.ref_name }}
    secrets: inherit
 
  notify_slack_on_failure:
    name: "Notify Slack on Failure"
    needs:
      - promote_docker_image
      - build_hugging_face_docker_image
      - build-pypi
      - delete-rc-assets
      - update-homebrew-tap
      - update-helm-chart
    runs-on: ubuntu-latest
    if: failure()
    steps:
      - name: Send Notification to Slack
        id: slack_notify_ops_release
        uses: slackapi/slack-github-action@v1.27
        with:
          channel-id: '${{ vars.SLACK_CH_RELEASE_TRAIN }}'
          slack-message: |
            One or more steps of Label Studio OpenSource release pipeline got failed! <!subteam^${{ vars.SLACK_GR_DEVOPS }}>
 
            ><https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|[Workflow run]>
        env:
          SLACK_BOT_TOKEN: ${{ secrets.SLACK_LSE_BOT_TOKEN }}