Skip to content

Commit

Permalink
feat: Allow code-freeze on any commit (#66)
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Koenig <[email protected]>
  • Loading branch information
ko3n1g authored Dec 11, 2024
1 parent 09bba72 commit 61b1605
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/_code_freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Code freeze"
name: 'Code freeze'

on:
workflow_call:
Expand All @@ -25,20 +25,23 @@ on:
release-type:
type: string
description: Type of release (major|minor)
freeze-commit:
type: string
description: Commit SHA to use for cut-off
secrets:
SLACK_RELEASE_ENDPOINT:
required: true
SLACK_WEBHOOK_ADMIN:
required: true
outputs:
release-branch:
description: "Released version (same as its branch name)"
release-branch:
description: 'Released version (same as its branch name)'
value: ${{ jobs.create-release-branch.outputs.version }}

defaults:
run:
shell: bash -x -e -u -o pipefail {0}

jobs:
create-release-branch:
runs-on: ubuntu-latest
Expand All @@ -51,7 +54,7 @@ jobs:
with:
path: ${{ github.run_id }}
fetch-depth: 0
ref: main
ref: ${{ inputs.freeze-commit }}

- name: Get release branch ref
id: release-branch
Expand Down Expand Up @@ -85,15 +88,15 @@ jobs:
cd ${{ github.run_id }}
MAJOR=$(cat ${{ inputs.python-package }}/package_info.py | awk '/^MAJOR = /' | awk -F"= " '{print $2}')
MINOR=$(cat ${{ inputs.python-package }}/package_info.py | awk '/^MINOR = /' | awk -F"= " '{print $2}')
if [[ "${{ inputs.release-type }}" == "major" ]]; then
NEXT_MAJOR=$(( MAJOR + 1))
NEXT_MINOR=0
else
NEXT_MAJOR=$MAJOR
NEXT_MINOR=$(( MINOR + 1))
fi
NEXT_PATCH=0
NEXT_PRERELEASE=rc0
NEXT_DEV=dev0
Expand Down Expand Up @@ -126,7 +129,7 @@ jobs:
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASE_ENDPOINT }}
RELEASE_BRANCH: ${{ needs.create-release-branch.outputs.version }}
SLACK_WEBHOOK_ADMIN: "<!subteam^${{ secrets.SLACK_WEBHOOK_ADMIN }}>"
SLACK_WEBHOOK_ADMIN: '<!subteam^${{ secrets.SLACK_WEBHOOK_ADMIN }}>'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit 61b1605

Please sign in to comment.