Skip to content

Commit 4fb89b0

Browse files
committed
chore: add version info into the release artifact
1 parent 3389cfe commit 4fb89b0

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ jobs:
7979
run: |
8080
GOOS=linux GOARCH=${{ matrix.arch }} go build \
8181
-ldflags "-X github.com/pgschema/pgschema/cmd.GitCommit=${{ steps.build_info.outputs.GIT_COMMIT }} -X 'github.com/pgschema/pgschema/cmd.BuildDate=${{ steps.build_info.outputs.BUILD_DATE }}'" \
82-
-o pgschema-linux-${{ matrix.arch }} .
82+
-o pgschema-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }} .
8383
8484
- name: Upload artifacts
8585
uses: actions/upload-artifact@v4
8686
with:
87-
name: pgschema-linux-${{ matrix.arch }}
88-
path: pgschema-linux-${{ matrix.arch }}
87+
name: pgschema-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}
88+
path: pgschema-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}
8989

9090
# Build macOS binaries (native build works fine)
9191
build-macos:
@@ -102,6 +102,10 @@ jobs:
102102
with:
103103
go-version: "1.24"
104104

105+
- name: Read version
106+
id: version
107+
run: echo "version=$(cat internal/version/VERSION)" >> $GITHUB_OUTPUT
108+
105109
- name: Run tests (short)
106110
run: go test -short -v ./...
107111

@@ -114,13 +118,13 @@ jobs:
114118
# Build for macOS ARM64
115119
GOOS=darwin GOARCH=arm64 go build \
116120
-ldflags "-X github.com/pgschema/pgschema/cmd.GitCommit=${GIT_COMMIT} -X 'github.com/pgschema/pgschema/cmd.BuildDate=${BUILD_DATE}'" \
117-
-o pgschema-darwin-arm64 .
121+
-o pgschema-${{ steps.version.outputs.version }}-darwin-arm64 .
118122
119123
- name: Upload artifacts
120124
uses: actions/upload-artifact@v4
121125
with:
122-
name: pgschema-darwin-arm64
123-
path: pgschema-darwin-arm64
126+
name: pgschema-${{ steps.version.outputs.version }}-darwin-arm64
127+
path: pgschema-${{ steps.version.outputs.version }}-darwin-arm64
124128

125129
packages:
126130
needs: build-linux
@@ -139,7 +143,7 @@ jobs:
139143
- name: Download Linux binary
140144
uses: actions/download-artifact@v4
141145
with:
142-
name: pgschema-linux-${{ matrix.arch }}
146+
name: pgschema-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}
143147
path: ./dist
144148

145149
- name: Install nfpm
@@ -150,9 +154,9 @@ jobs:
150154
151155
- name: Prepare binary
152156
run: |
153-
chmod +x ./dist/pgschema-linux-${{ matrix.arch }}
157+
chmod +x ./dist/pgschema-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}
154158
mkdir -p ./package/usr/bin
155-
cp ./dist/pgschema-linux-${{ matrix.arch }} ./package/usr/bin/pgschema
159+
cp ./dist/pgschema-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }} ./package/usr/bin/pgschema
156160
mkdir -p ./package/usr/share/doc/pgschema
157161
cp LICENSE ./package/usr/share/doc/pgschema/
158162
@@ -229,9 +233,9 @@ jobs:
229233
name: Release v${{ steps.version.outputs.version }}
230234
generate_release_notes: true
231235
files: |
232-
binaries/pgschema-linux-amd64/pgschema-linux-amd64
233-
binaries/pgschema-linux-arm64/pgschema-linux-arm64
234-
binaries/pgschema-darwin-arm64/pgschema-darwin-arm64
236+
binaries/pgschema-${{ steps.version.outputs.version }}-linux-amd64/pgschema-${{ steps.version.outputs.version }}-linux-amd64
237+
binaries/pgschema-${{ steps.version.outputs.version }}-linux-arm64/pgschema-${{ steps.version.outputs.version }}-linux-arm64
238+
binaries/pgschema-${{ steps.version.outputs.version }}-darwin-arm64/pgschema-${{ steps.version.outputs.version }}-darwin-arm64
235239
binaries/pgschema-deb-amd64/*.deb
236240
binaries/pgschema-deb-arm64/*.deb
237241
binaries/pgschema-rpm-amd64/*.rpm
@@ -314,7 +318,7 @@ jobs:
314318
formula-name: pgschema
315319
formula-path: Formula/pgschema.rb
316320
homebrew-tap: pgschema/homebrew-pgschema
317-
download-url: https://github.com/pgschema/pgschema/releases/download/v${{ steps.version.outputs.version }}/pgschema-darwin-arm64
321+
download-url: https://github.com/pgschema/pgschema/releases/download/v${{ steps.version.outputs.version }}/pgschema-${{ steps.version.outputs.version }}-darwin-arm64
318322
commit-message: |
319323
pgschema ${{ steps.version.outputs.version }}
320324
env:

0 commit comments

Comments
 (0)