-
Notifications
You must be signed in to change notification settings - Fork 17
95 lines (75 loc) · 2.62 KB
/
Copy pathrelease-beta-version.yml
File metadata and controls
95 lines (75 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Automates Releasing a Beta Version on a Feature Branch
# melos version ensemble [version]
# git push --follow-tags origin [branch]
name: Release Beta Version
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to release from (cannot be main/master)"
required: true
type: string
default: "feature/my-branch"
version:
description: "Beta version (must be X.Y.Z-beta.N format)"
required: true
type: string
default: "1.2.47-beta.1"
concurrency:
group: melos-beta-release-${{ github.repository }}-${{ inputs.branch }}
cancel-in-progress: false
permissions:
contents: write
jobs:
version-and-push:
runs-on: ubuntu-latest
steps:
- name: Validate inputs
run: |
set -euo pipefail
branch="${{ inputs.branch }}"
version="${{ inputs.version }}"
# Block main/master branches
if [[ "$branch" == "main" || "$branch" == "master" ]]; then
echo "::error::Cannot release beta to main/master. Use 'Release Ensemble Version' workflow instead."
exit 1
fi
# Validate beta version format
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$ ]]; then
echo "::error::Version must be in format X.Y.Z-beta.N (e.g., 1.2.47-beta.1)"
exit 1
fi
echo "Branch: $branch"
echo "Version: $version"
- name: Check branch exists
run: |
set -euo pipefail
branch="${{ inputs.branch }}"
if ! git ls-remote --heads "https://github.com/${{ github.repository }}.git" "$branch" | grep -q "$branch"; then
echo "::error::Branch '$branch' does not exist on remote."
exit 1
fi
echo "Branch '$branch' exists."
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: "3.32.5"
cache: true
- name: Install Melos
run: dart pub global activate melos
- name: Bootstrap
run: melos bootstrap
- name: Version packages
run: melos version ensemble "${{ inputs.version }}" --yes
- name: Push to feature branch
run: git push origin ${{ inputs.branch }} --follow-tags