Skip to content

Commit 2654c25

Browse files
committed
feat: update MySQL Shell versions and improve workflows
- Update MySQL Shell versions - Innovation: 9.2.0 - LTS: 8.4.4 - Improve GitHub Actions workflows - Add branch protection for develop and main - Implement git-pr-release workflow - Optimize permissions and security settings - Update documentation with new versions and workflow
1 parent 3a543d6 commit 2654c25

File tree

6 files changed

+147
-6
lines changed

6 files changed

+147
-6
lines changed

.github/pr-release/template.erb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Release <%= Time.now.strftime("%Y-%m-%d %H:%M:%S") %>
2+
3+
## Pull Requests
4+
5+
<% pull_requests.each do |pr| -%>
6+
- [ ] #<%= pr.number %> <%= pr.title %> (@<%= pr.author %>)
7+
<% end -%>
8+
9+
## Post Release Tasks
10+
11+
```bash
12+
git checkout <%= production_branch %>
13+
git pull origin <%= production_branch %>
14+
git tag $(date +"%Y%m%d_%H%M%S")
15+
git push origin $(date +"%Y%m%d_%H%M%S")
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Create Release PR
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
paths-ignore:
8+
- "**.md"
9+
workflow_dispatch:
10+
11+
permissions: read-all
12+
13+
jobs:
14+
create-release-pr:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: 3.2
25+
bundler-cache: true
26+
27+
- name: Configure Git
28+
run: |
29+
git config --global user.email github-actions[bot]@users.noreply.github.com
30+
git config --global user.name github-actions[bot]
31+
32+
- name: Install git-pr-release
33+
run: gem install git-pr-release --no-document
34+
35+
- name: Create Release PR
36+
env:
37+
GIT_PR_RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
GIT_PR_RELEASE_BRANCH_PRODUCTION: main
39+
GIT_PR_RELEASE_BRANCH_STAGING: develop
40+
GIT_PR_RELEASE_TEMPLATE: .github/pr-release/template.erb
41+
GIT_PR_RELEASE_LABELS: release
42+
run: git-pr-release

.github/workflows/docker-build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
name: Build MySQL Shell Docker Images
22

3-
# Add explicit permissions
43
permissions:
54
contents: read
65
packages: write
76

87
on:
98
push:
10-
branches: [ main ]
9+
branches:
10+
- main
11+
- develop
12+
- feat-*
1113
paths:
1214
- docker/**
1315
- .github/workflows/docker-build.yml
1416
pull_request:
15-
branches: [ main ]
17+
branches:
18+
- main
19+
- develop
1620
paths:
1721
- docker/**
1822
- .github/workflows/docker-build.yml
@@ -47,7 +51,7 @@ jobs:
4751
uses: docker/build-push-action@v5
4852
with:
4953
context: ./docker/${{ matrix.series }}
50-
push: ${{ github.event_name != 'pull_request' }}
54+
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
5155
tags: |
5256
snickerjp/docker-mysql-shell:${{ matrix.version }}
5357
snickerjp/docker-mysql-shell:${{ matrix.extra_tag }}

.github/workflows/docker-image.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ jobs:
2424
matrix:
2525
include:
2626
- series: innovation
27-
version: "9.2"
27+
version: 9.2
28+
extra_tag: innovation
2829
- series: lts
29-
version: "8.4"
30+
version: 8.4
31+
extra_tag: lts
3032
steps:
3133
- name: Check out the repo
3234
uses: actions/checkout@v4
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Review Feature Branch
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
types: [opened, synchronize, reopened]
8+
9+
permissions: read-all
10+
11+
jobs:
12+
review:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- series: innovation
18+
version: 9.2
19+
- series: lts
20+
version: 8.4
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Build test
31+
uses: docker/build-push-action@v5
32+
with:
33+
context: ./docker/${{ matrix.series }}
34+
push: false
35+
load: true
36+
37+
- name: Add PR Review Comment
38+
uses: actions/github-script@v7
39+
with:
40+
script: |
41+
const prNumber = context.payload.pull_request.number;
42+
const branchName = context.payload.pull_request.head.ref;
43+
44+
if (!branchName.startsWith('feat-')) {
45+
await github.rest.issues.createComment({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: prNumber,
49+
body: '⚠️ Warning: Branch name should start with `feat-`'
50+
});
51+
}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,30 @@ docker run -it snickerjp/docker-mysql-shell:innovation --uri mysql://user:pass@h
6262
docker run -it snickerjp/docker-mysql-shell:8.4 --uri mysql://user:pass@host:port/schema
6363
# or using lts tag
6464
docker run -it snickerjp/docker-mysql-shell:lts --uri mysql://user:pass@host:port/schema
65+
```
66+
67+
## Development Workflow
68+
69+
### Branch Strategy
70+
71+
- `feat-*`: Feature branches for new features and improvements
72+
- `develop`: Integration branch for feature branches
73+
- `main`: Release branch
74+
75+
### Pull Request Process
76+
77+
1. Create a new feature branch from `develop`:
78+
```bash
79+
git checkout develop
80+
git pull origin develop
81+
git checkout -b feat-your-feature-name
82+
```
83+
84+
2. Make your changes and create a PR to `develop`
85+
3. After PR is merged to `develop`, it will be included in the next release PR
86+
4. Release PRs are automatically created from `develop` to `main` using git-pr-release
87+
88+
### Protected Branches
89+
90+
- `develop`: Requires PR review and successful status checks
91+
- `main`: Protected release branch, only accepts PRs from `develop`

0 commit comments

Comments
 (0)