File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,3 +271,36 @@ jobs:
271271 parse_mode: "Markdown",
272272 disable_web_page_preview: true
273273 }')"
274+
275+ sync-version-file :
276+ needs : [release]
277+ if : ${{ needs.release.result == 'success' }}
278+ runs-on : ubuntu-latest
279+ steps :
280+ - name : Checkout default branch
281+ uses : actions/checkout@v6
282+ with :
283+ ref : ${{ github.event.repository.default_branch }}
284+
285+ - name : Sync VERSION file to released tag
286+ run : |
287+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
288+ VERSION=${{ github.event.inputs.tag }}
289+ VERSION=${VERSION#v}
290+ else
291+ VERSION=${GITHUB_REF#refs/tags/v}
292+ fi
293+
294+ CURRENT_VERSION=$(tr -d '\r\n' < backend/cmd/server/VERSION || true)
295+ if [ "$CURRENT_VERSION" = "$VERSION" ]; then
296+ echo "VERSION file already matches $VERSION"
297+ exit 0
298+ fi
299+
300+ echo "$VERSION" > backend/cmd/server/VERSION
301+
302+ git config user.name "github-actions[bot]"
303+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
304+ git add backend/cmd/server/VERSION
305+ git commit -m "chore: sync VERSION to ${VERSION} [skip ci]"
306+ git push origin HEAD:${{ github.event.repository.default_branch }}
You can’t perform that action at this time.
0 commit comments