|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + mode: |
| 7 | + description: | |
| 8 | + How to set the version: |
| 9 | + - explicit: set to a specific value (e.g., 1.3-alpha) |
| 10 | + - bump: bump major/minor/patch from current SimpleVersion and apply optional prerelease |
| 11 | + - auto: policy-based (develop->next minor -alpha; hotfix/*->next patch -alpha; main/vX.Y->stable) |
| 12 | + type: choice |
| 13 | + options: [auto, bump, explicit] |
| 14 | + default: auto |
| 15 | + version: |
| 16 | + description: "When mode=explicit: exact version (e.g., 1.3-alpha, 1.2.3, 1.4.0-rc)" |
| 17 | + type: string |
| 18 | + default: "" |
| 19 | + increment: |
| 20 | + description: "When mode=bump: major | minor | patch" |
| 21 | + type: choice |
| 22 | + options: [major, minor, patch] |
| 23 | + default: patch |
| 24 | + prerelease: |
| 25 | + description: "When mode=bump: prerelease suffix WITHOUT leading dash (e.g., alpha, beta, rc). Leave blank for stable." |
| 26 | + type: string |
| 27 | + default: "" |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: write |
| 31 | + pull-requests: write |
| 32 | + packages: write |
| 33 | + |
| 34 | +run-name: "Create Release · ${{ inputs.mode }} · ${{ github.ref_name }}" |
| 35 | + |
| 36 | +jobs: |
| 37 | + validate-inputs: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Check conditional requirements |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + MODE='${{ inputs.mode }}' |
| 44 | + VERSION='${{ inputs.version }}' |
| 45 | + INCR='${{ inputs.increment }}' |
| 46 | + if [[ "$MODE" == "explicit" && -z "$VERSION" ]]; then |
| 47 | + echo "❌ mode=explicit requires 'version' (e.g., 1.3-alpha)."; exit 1 |
| 48 | + fi |
| 49 | + if [[ "$MODE" == "bump" && -z "$INCR" ]]; then |
| 50 | + echo "❌ mode=bump requires 'increment' (major|minor|patch)."; exit 1 |
| 51 | + fi |
| 52 | + echo "✅ inputs look good." |
| 53 | +
|
| 54 | + set-version: |
| 55 | + needs: validate-inputs |
| 56 | + uses: Stillpoint-Software/shared-workflows/.github/workflows/set_version.yml@main |
| 57 | + with: |
| 58 | + target_branch: ${{ github.ref_name }} |
| 59 | + mode: ${{ inputs.mode }} |
| 60 | + version: ${{ inputs.version }} |
| 61 | + increment: ${{ inputs.increment }} |
| 62 | + prerelease: ${{ inputs.prerelease }} |
| 63 | + secrets: inherit |
| 64 | + |
| 65 | + create-release: |
| 66 | + needs: set-version |
| 67 | + uses: Stillpoint-Software/shared-workflows/.github/workflows/prepare_release.yml@main |
| 68 | + with: |
| 69 | + target_branch: ${{ github.ref_name }} |
| 70 | + tag: ${{ needs.set-version.outputs.tag }} |
| 71 | + prerelease: ${{ needs.set-version.outputs.new_prerelease }} |
| 72 | + draft: true |
| 73 | + secrets: |
| 74 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments