|
| 1 | +# |
| 2 | +# Copyright (c) 2026, The OpenThread Authors. |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# Redistribution and use in source and binary forms, with or without |
| 6 | +# modification, are permitted provided that the following conditions are met: |
| 7 | +# 1. Redistributions of source code must retain the above copyright |
| 8 | +# notice, this list of conditions and the following disclaimer. |
| 9 | +# 2. Redistributions in binary form must reproduce the above copyright |
| 10 | +# notice, this list of conditions and the following disclaimer in the |
| 11 | +# documentation and/or other materials provided with the distribution. |
| 12 | +# 3. Neither the name of the copyright holder nor the |
| 13 | +# names of its contributors may be used to endorse or promote products |
| 14 | +# derived from this software without specific prior written permission. |
| 15 | +# |
| 16 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 20 | +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 | +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 | +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 | +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 26 | +# POSSIBILITY OF SUCH DAMAGE. |
| 27 | +# |
| 28 | + |
| 29 | +name: Monthly CalVer Release |
| 30 | + |
| 31 | +on: |
| 32 | + schedule: |
| 33 | + # Runs at 00:00 UTC on the 1st day of every month |
| 34 | + - cron: '0 0 1 * *' |
| 35 | + |
| 36 | + # Allows you to trigger the workflow manually from the GitHub Actions UI |
| 37 | + workflow_dispatch: |
| 38 | + inputs: |
| 39 | + tag_override: |
| 40 | + description: 'Custom Tag Name (e.g., v2026.05.1). Leave blank for auto CalVer.' |
| 41 | + required: false |
| 42 | + type: string |
| 43 | + |
| 44 | +jobs: |
| 45 | + create-release: |
| 46 | + name: Create Monthly Release |
| 47 | + runs-on: ubuntu-24.04 |
| 48 | + |
| 49 | + # Required permission to create tags and releases |
| 50 | + permissions: |
| 51 | + contents: write |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: Harden Runner |
| 55 | + uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 |
| 56 | + with: |
| 57 | + egress-policy: block |
| 58 | + allowed-endpoints: > |
| 59 | + api.github.com:443 |
| 60 | + github.com:443 |
| 61 | +
|
| 62 | + - name: Checkout repository |
| 63 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 64 | + with: |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Generate CalVer Tag Name |
| 68 | + id: generate_tag |
| 69 | + env: |
| 70 | + TAG_OVERRIDE: ${{ inputs.tag_override }} |
| 71 | + # Formats the date as vYYYY.MM.0 (e.g., v2026.06.0) or uses override if provided |
| 72 | + run: | |
| 73 | + if [ -n "$TAG_OVERRIDE" ]; then |
| 74 | + CALVER_TAG="$TAG_OVERRIDE" |
| 75 | + else |
| 76 | + CALVER_TAG="v$(date +'%Y.%m').0" |
| 77 | + fi |
| 78 | + echo "TAG_NAME=$CALVER_TAG" >> $GITHUB_ENV |
| 79 | + echo "Generated tag: $CALVER_TAG" |
| 80 | +
|
| 81 | + - name: Create GitHub Release |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + # Uses the built-in GitHub CLI to create the tag and release simultaneously |
| 85 | + run: | |
| 86 | + gh release create "$TAG_NAME" \ |
| 87 | + --target "${{ github.ref_name }}" \ |
| 88 | + --title "OpenThread $TAG_NAME" \ |
| 89 | + --generate-notes |
0 commit comments