1+ # Copyright (c) 2026 ZettaScale Technology
2+ #
3+ # This program and the accompanying materials are made available under the
4+ # terms of the Eclipse Public License 2.0 which is available at
5+ # http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
6+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
7+ #
8+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
9+ #
10+ # Contributors:
11+ # ZettaScale Zenoh Team, <zenoh@zettascale.tech>
12+ #
13+ name : Release
14+
15+ on :
16+ schedule :
17+ - cron : " 0 0 * * 1-5"
18+ workflow_dispatch :
19+ inputs :
20+ live-run :
21+ type : boolean
22+ description : Live-run
23+ required : false
24+ default : false
25+ version :
26+ type : string
27+ description : Release number
28+ required : false
29+ branch :
30+ type : string
31+ description : Release branch
32+ required : false
33+
34+ jobs :
35+ version_and_tag :
36+ name : Compute version and tag
37+ runs-on : ubuntu-latest
38+ outputs :
39+ version : ${{ steps.version_and_tag.outputs.version }}
40+ tag : ${{ steps.version_and_tag.outputs.tag }}
41+ steps :
42+ - uses : actions/checkout@v4
43+ with :
44+ fetch-depth : 0 # Fetch all history for all tags and branches
45+
46+ - id : version_and_tag
47+ name : Compute version and tag
48+ run : |
49+ set -euo pipefail
50+
51+ if [ -n "${{ inputs.version }}" ]; then
52+ raw_version='${{ inputs.version }}'
53+ else
54+ # Extract the version from the latest tag
55+ raw_version=$(git tag --list 'v*' --sort=-version:refname | head -n 1)
56+ if [ -z "$raw_version" ]; then
57+ echo "No release tag matching v* found"
58+ exit 1
59+ fi
60+ fi
61+
62+ version="${raw_version#v}"
63+ # Use 'v' prefix in the tag for go modules compatibility'
64+ tag="v${version}"
65+
66+ printf "version=%s\n" "$version" >> "$GITHUB_OUTPUT"
67+ printf "tag=%s\n" "$tag" >> "$GITHUB_OUTPUT"
68+ tag :
69+ name : Branch, Bump & tag
70+ runs-on : ubuntu-latest
71+ needs : version_and_tag
72+ outputs :
73+ branch : ${{ steps.create-release-branch.outputs.branch }}
74+ steps :
75+ - id : create-release-branch
76+ uses : eclipse-zenoh/ci/create-release-branch@main
77+ with :
78+ repo : ${{ github.repository }}
79+ live-run : ${{ inputs.live-run || false }}
80+ version : ${{ needs.version_and_tag.outputs.version }}
81+ branch : ${{ inputs.branch }}
82+ github-token : ${{ secrets.BOT_TOKEN_WORKFLOW }}
83+
84+ - name : Checkout release branch
85+ uses : actions/checkout@v4
86+ with :
87+ ref : ${{ steps.create-release-branch.outputs.branch }}
88+ fetch-depth : 0
89+ token : ${{ secrets.BOT_TOKEN_WORKFLOW }}
90+
91+ - name : Create annotated tag
92+ if : ${{ inputs.live-run || false }}
93+ shell : bash
94+ run : |
95+ git fetch --tags origin
96+ if git rev-parse '${{ needs.version_and_tag.outputs.tag }}' >/dev/null 2>&1; then
97+ echo "Tag ${{ needs.version_and_tag.outputs.tag }} already exists"
98+ exit 1
99+ fi
100+ git config user.name "eclipse-zenoh-bot"
101+ git config user.email "eclipse-zenoh-bot@users.noreply.github.com"
102+ git tag -a '${{ needs.version_and_tag.outputs.tag }}' -m '${{ needs.version_and_tag.outputs.tag }}'
103+
104+ - name : Push tag
105+ if : ${{ inputs.live-run || false }}
106+ shell : bash
107+ run : |
108+ git push origin '${{ needs.version_and_tag.outputs.tag }}'
109+
110+ - name : Create GitHub Release
111+ if : ${{ inputs.live-run || false }}
112+ uses : softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
113+ with :
114+ draft : false
115+ prerelease : false
116+ tag_name : ${{ needs.version_and_tag.outputs.tag }}
117+ generate_release_notes : true
118+ env :
119+ GITHUB_TOKEN : ${{ secrets.BOT_TOKEN_WORKFLOW }}
0 commit comments