chore: adding workflow
Browse files
.github/workflows/pr-release-validation.yaml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: PR Validation
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
types: [opened, synchronize, reopened, labeled, unlabeled]
|
| 6 |
+
branches:
|
| 7 |
+
- main
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
validate:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
|
| 13 |
+
steps:
|
| 14 |
+
- uses: actions/checkout@v4
|
| 15 |
+
|
| 16 |
+
- name: Validate PR Labels
|
| 17 |
+
run: |
|
| 18 |
+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'stable-release') }}" == "true" ]]; then
|
| 19 |
+
echo "✓ PR has stable-release label"
|
| 20 |
+
|
| 21 |
+
# Check version bump labels
|
| 22 |
+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'major') }}" == "true" ]]; then
|
| 23 |
+
echo "✓ Major version bump requested"
|
| 24 |
+
elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'minor') }}" == "true" ]]; then
|
| 25 |
+
echo "✓ Minor version bump requested"
|
| 26 |
+
else
|
| 27 |
+
echo "✓ Patch version bump will be applied"
|
| 28 |
+
fi
|
| 29 |
+
else
|
| 30 |
+
echo "This PR doesn't have the stable-release label. No release will be created."
|
| 31 |
+
fi
|
.github/workflows/update-stable.yml
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
name: Update Stable Branch
|
| 2 |
|
| 3 |
on:
|
| 4 |
-
|
| 5 |
-
types: [closed]
|
| 6 |
branches:
|
| 7 |
- main
|
| 8 |
|
|
@@ -10,18 +9,15 @@ permissions:
|
|
| 10 |
contents: write
|
| 11 |
|
| 12 |
jobs:
|
| 13 |
-
|
| 14 |
-
if:
|
| 15 |
runs-on: ubuntu-latest
|
| 16 |
-
permissions:
|
| 17 |
-
contents: write
|
| 18 |
-
pull-requests: read
|
| 19 |
|
| 20 |
steps:
|
| 21 |
- uses: actions/checkout@v4
|
| 22 |
with:
|
| 23 |
fetch-depth: 0
|
| 24 |
-
|
| 25 |
- name: Configure Git
|
| 26 |
run: |
|
| 27 |
git config --global user.name 'github-actions[bot]'
|
|
@@ -52,17 +48,6 @@ jobs:
|
|
| 52 |
restore-keys: |
|
| 53 |
${{ runner.os }}-pnpm-store-
|
| 54 |
|
| 55 |
-
- name: Determine Version Bump
|
| 56 |
-
id: version_bump
|
| 57 |
-
run: |
|
| 58 |
-
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'major') }}" == "true" ]]; then
|
| 59 |
-
echo "bump=major" >> $GITHUB_OUTPUT
|
| 60 |
-
elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'minor') }}" == "true" ]]; then
|
| 61 |
-
echo "bump=minor" >> $GITHUB_OUTPUT
|
| 62 |
-
else
|
| 63 |
-
echo "bump=patch" >> $GITHUB_OUTPUT
|
| 64 |
-
fi
|
| 65 |
-
|
| 66 |
- name: Get Current Version
|
| 67 |
id: current_version
|
| 68 |
run: |
|
|
@@ -72,6 +57,18 @@ jobs:
|
|
| 72 |
- name: Install semver
|
| 73 |
run: pnpm add -g semver
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
- name: Bump Version
|
| 76 |
id: bump_version
|
| 77 |
run: |
|
|
@@ -161,32 +158,30 @@ jobs:
|
|
| 161 |
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
|
| 162 |
echo "EOF" >> $GITHUB_OUTPUT
|
| 163 |
|
| 164 |
-
- name: Commit
|
| 165 |
run: |
|
| 166 |
git pull
|
| 167 |
git add package.json pnpm-lock.yaml changelog.md
|
| 168 |
-
git commit -m "chore:
|
|
|
|
| 169 |
git push
|
|
|
|
| 170 |
|
| 171 |
- name: Update Stable Branch
|
| 172 |
run: |
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
|
| 178 |
-
- name: Create
|
|
|
|
|
|
|
| 179 |
run: |
|
| 180 |
VERSION="v${{ steps.bump_version.outputs.new_version }}"
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
# env:
|
| 186 |
-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 187 |
-
# run: |
|
| 188 |
-
# VERSION="v${{ steps.bump_version.outputs.new_version }}"
|
| 189 |
-
# gh release create "$VERSION" \
|
| 190 |
-
# --title "Release $VERSION" \
|
| 191 |
-
# --notes "${{ steps.changelog.outputs.content }}" \
|
| 192 |
-
# --target stable
|
|
|
|
| 1 |
name: Update Stable Branch
|
| 2 |
|
| 3 |
on:
|
| 4 |
+
push:
|
|
|
|
| 5 |
branches:
|
| 6 |
- main
|
| 7 |
|
|
|
|
| 9 |
contents: write
|
| 10 |
|
| 11 |
jobs:
|
| 12 |
+
prepare-release:
|
| 13 |
+
if: contains(github.event.head_commit.message, '#release')
|
| 14 |
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
steps:
|
| 17 |
- uses: actions/checkout@v4
|
| 18 |
with:
|
| 19 |
fetch-depth: 0
|
| 20 |
+
|
| 21 |
- name: Configure Git
|
| 22 |
run: |
|
| 23 |
git config --global user.name 'github-actions[bot]'
|
|
|
|
| 48 |
restore-keys: |
|
| 49 |
${{ runner.os }}-pnpm-store-
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
- name: Get Current Version
|
| 52 |
id: current_version
|
| 53 |
run: |
|
|
|
|
| 57 |
- name: Install semver
|
| 58 |
run: pnpm add -g semver
|
| 59 |
|
| 60 |
+
- name: Determine Version Bump
|
| 61 |
+
id: version_bump
|
| 62 |
+
run: |
|
| 63 |
+
COMMIT_MSG="${{ github.event.head_commit.message }}"
|
| 64 |
+
if [[ $COMMIT_MSG =~ "#release:major" ]]; then
|
| 65 |
+
echo "bump=major" >> $GITHUB_OUTPUT
|
| 66 |
+
elif [[ $COMMIT_MSG =~ "#release:minor" ]]; then
|
| 67 |
+
echo "bump=minor" >> $GITHUB_OUTPUT
|
| 68 |
+
else
|
| 69 |
+
echo "bump=patch" >> $GITHUB_OUTPUT
|
| 70 |
+
fi
|
| 71 |
+
|
| 72 |
- name: Bump Version
|
| 73 |
id: bump_version
|
| 74 |
run: |
|
|
|
|
| 158 |
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
|
| 159 |
echo "EOF" >> $GITHUB_OUTPUT
|
| 160 |
|
| 161 |
+
- name: Commit and Tag Release
|
| 162 |
run: |
|
| 163 |
git pull
|
| 164 |
git add package.json pnpm-lock.yaml changelog.md
|
| 165 |
+
git commit -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
|
| 166 |
+
git tag "v${{ steps.bump_version.outputs.new_version }}"
|
| 167 |
git push
|
| 168 |
+
git push --tags
|
| 169 |
|
| 170 |
- name: Update Stable Branch
|
| 171 |
run: |
|
| 172 |
+
if ! git checkout stable 2>/dev/null; then
|
| 173 |
+
echo "Creating new stable branch..."
|
| 174 |
+
git checkout -b stable
|
| 175 |
+
fi
|
| 176 |
+
git merge main --no-ff -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
|
| 177 |
+
git push --set-upstream origin stable --force
|
| 178 |
|
| 179 |
+
- name: Create GitHub Release
|
| 180 |
+
env:
|
| 181 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 182 |
run: |
|
| 183 |
VERSION="v${{ steps.bump_version.outputs.new_version }}"
|
| 184 |
+
gh release create "$VERSION" \
|
| 185 |
+
--title "Release $VERSION" \
|
| 186 |
+
--notes "${{ steps.changelog.outputs.content }}" \
|
| 187 |
+
--target stable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|