Skip to content

Commit abb14fd

Browse files
Merge pull request #2 from scutuatua-crypto/copilot/sync-upstream-setup-release-v1-0-0
[WIP] Complete repository setup for gh-ost fork
2 parents 27878d6 + 2cc0080 commit abb14fd

2 files changed

Lines changed: 139 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish Go Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to publish (e.g. v1.0.0)'
11+
required: true
12+
default: 'v1.0.0'
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
validate:
19+
name: Validate and Test
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.inputs.tag || github.ref }}
25+
26+
- name: Set up Go
27+
uses: actions/setup-go@v6
28+
with:
29+
go-version-file: go.mod
30+
31+
- name: Download dependencies
32+
run: go mod download
33+
34+
- name: Verify dependencies
35+
run: go mod verify
36+
37+
- name: Build
38+
run: go build ./...
39+
40+
- name: Run unit tests
41+
run: go test ./go/...
42+
43+
notify-pkg-go-dev:
44+
name: Notify pkg.go.dev
45+
needs: validate
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Trigger pkg.go.dev indexing
49+
env:
50+
MODULE: github.com/github/gh-ost
51+
VERSION: ${{ github.event.inputs.tag || github.ref_name }}
52+
run: |
53+
echo "Requesting indexing of ${MODULE}@${VERSION} on pkg.go.dev..."
54+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
55+
"https://sum.golang.org/lookup/${MODULE}@${VERSION}")
56+
echo "sum.golang.org response: ${STATUS}"
57+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
58+
"https://proxy.golang.org/${MODULE}/@v/${VERSION}.info")
59+
echo "proxy.golang.org response: ${STATUS}"
60+
echo "Package will be available at: https://pkg.go.dev/${MODULE}@${VERSION}"

.github/workflows/release.yml

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release (e.g. v1.0.0)'
11+
required: true
12+
default: 'v1.0.0'
13+
prerelease:
14+
description: 'Mark as pre-release'
15+
required: false
16+
default: 'false'
17+
type: boolean
718

819
permissions:
920
contents: write
@@ -15,6 +26,7 @@ jobs:
1526
- uses: actions/checkout@v4
1627
with:
1728
fetch-depth: 0
29+
ref: ${{ github.event.inputs.tag || github.ref }}
1830

1931
- name: Set up Go
2032
uses: actions/setup-go@v6
@@ -29,12 +41,78 @@ jobs:
2941
3042
- name: Build release binaries
3143
env:
32-
RELEASE_VERSION: ${{ github.ref_name }}
44+
RELEASE_VERSION: ${{ github.event.inputs.tag || github.ref_name }}
3345
run: |
3446
bash build.sh
3547
3648
- name: Create GitHub Release
3749
uses: softprops/action-gh-release@v2
3850
with:
51+
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
3952
files: /tmp/gh-ost-release/gh-ost-binary-*
53+
prerelease: ${{ github.event.inputs.prerelease == 'true' }}
4054
generate_release_notes: true
55+
body: |
56+
## gh-ost ${{ github.event.inputs.tag || github.ref_name }}
57+
58+
Online Schema Migration tool for MySQL — fork of [github/gh-ost](https://github.com/github/gh-ost).
59+
60+
### What's New
61+
62+
#### Bug Fixes (from upstream)
63+
- **Fix abort/retry interaction** ([#1655](https://github.com/github/gh-ost/pull/1655)) — Correctly handles retry after abort; warning errors now abort immediately instead of retrying unnecessarily.
64+
- **Fix handling of warnings on DML batches** ([#1643](https://github.com/github/gh-ost/pull/1643)) — Properly handles warnings that occur in the middle of a DML batch.
65+
- **Fix local tests permission errors** ([#1644](https://github.com/github/gh-ost/pull/1644)) — Makes `.gopath` writable to avoid toolchain `rm` permission errors in local tests.
66+
67+
#### Repository Improvements
68+
- GitHub Actions CI workflow with Go 1.22 and 1.23 matrix
69+
- Automated release workflow with binary packaging
70+
- CodeQL security scanning
71+
- golangci-lint integration
72+
- Makefile for common development tasks
73+
- Pre-commit hooks configuration
74+
- Go package publishing workflow
75+
76+
### Supported Platforms
77+
78+
| Platform | Architecture | Package |
79+
|----------|-------------|---------|
80+
| Linux | amd64 | `gh-ost-binary-linux-amd64.tar.gz` |
81+
| Linux | arm64 | `gh-ost-binary-linux-arm64.tar.gz` |
82+
| macOS | amd64 | `gh-ost-binary-darwin-amd64.tar.gz` |
83+
| macOS | arm64 (M1+) | `gh-ost-binary-darwin-arm64.tar.gz` |
84+
85+
### Installation
86+
87+
Download the appropriate binary for your platform from the assets below, then:
88+
89+
```bash
90+
tar xzf gh-ost-binary-*.tar.gz
91+
sudo mv gh-ost /usr/local/bin/
92+
gh-ost --version
93+
```
94+
95+
### Use as a Go Module
96+
97+
```go
98+
import "github.com/github/gh-ost/go/base"
99+
```
100+
101+
```bash
102+
go get github.com/github/gh-ost@${{ github.event.inputs.tag || github.ref_name }}
103+
```
104+
105+
### Quick Start
106+
107+
```bash
108+
gh-ost \
109+
--user="migration_user" \
110+
--password="secret" \
111+
--host="replica.example.com" \
112+
--database="mydb" \
113+
--table="mytable" \
114+
--alter="ADD COLUMN status TINYINT NOT NULL DEFAULT 0" \
115+
--execute
116+
```
117+
118+
See the [documentation](https://github.com/github/gh-ost/tree/master/doc) for full usage details.

0 commit comments

Comments
 (0)