-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (118 loc) · 4.28 KB
/
release.yml
File metadata and controls
139 lines (118 loc) · 4.28 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: build
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
id-token: write
jobs:
release-sql-to-logsql:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: '0'
fetch-tags: 'true'
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: 1.26
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Check licenses and vulnerabilities
run: make check
- name: Fetch tags
run: |
if [[ "${{ github.ref_type }}" != "tag" ]]; then
git fetch --tags
else
echo "Skipping tag fetch - already on tag ${{ github.ref_name }}"
fi
- name: Run ui build
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
else
LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
[ -z "$LATEST_TAG" ] && { echo "No release tag found"; exit 1; }
TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
echo "Using latest tag: $LATEST_TAG"
fi
cp cmd/sql-to-logsql/web/ui/package.json cmd/sql-to-logsql/web/ui/package.json.backup
cp cmd/sql-to-logsql/web/ui/package-lock.json cmd/sql-to-logsql/web/ui/package-lock.json.backup
sed -i "s/\${VERSION}/$TAG_VERSION/g" cmd/sql-to-logsql/web/ui/package.json
echo "Version: $TAG_VERSION"
make ui-build
cat cmd/sql-to-logsql/web/ui/package.json.backup > cmd/sql-to-logsql/web/ui/package.json
cat cmd/sql-to-logsql/web/ui/package-lock.json.backup > cmd/sql-to-logsql/web/ui/package-lock.json
rm cmd/sql-to-logsql/web/ui/package.json.backup
rm cmd/sql-to-logsql/web/ui/package-lock.json.backup
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11
- name: Tests
run: make test
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Docker Login
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release
uses: goreleaser/goreleaser-action@v7
if: success() && startsWith(github.ref, 'refs/tags/')
with:
args: release --clean --verbose --timeout 60m -f .goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-logsql-jdbc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: '0'
fetch-tags: 'true'
- name: Install JDK and Maven
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Fetch tags
run: |
if [[ "${{ github.ref_type }}" != "tag" ]]; then
git fetch --tags
else
echo "Skipping tag fetch - already on tag ${{ github.ref_name }}"
fi
- name: Update Configuration
working-directory: logsql-jdbc
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
else
LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
[ -z "$LATEST_TAG" ] && { echo "No release tag found"; exit 1; }
TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
echo "Using latest tag: $LATEST_TAG"
fi
mvn versions:set versions:commit -DnewVersion="${TAG_VERSION}";
- name: Publish package
working-directory: logsql-jdbc
run: |
mvn -s ${{ github.workspace }}/.github/workflows/settings.xml -DskipTests --batch-mode deploy
rm -rf */target/logsql-jdbc-*.jar
env:
USERNAME: ${{ secrets.USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}