Skip to content

Commit 2825390

Browse files
committed
feat: add Windows builds and compressed releases
1 parent c805cd4 commit 2825390

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags: ["v*"]
66
branches: ["main"]
77

8+
permissions:
9+
contents: write
10+
packages: write
11+
812
jobs:
913
docker:
1014
runs-on: ubuntu-latest
@@ -21,7 +25,7 @@ jobs:
2125
- name: Build and push
2226
uses: docker/build-push-action@v5
2327
with:
24-
push: true
28+
push: ${{ startsWith(github.ref, 'refs/tags/') }} # Only push on tags
2529
tags: |
2630
ghcr.io/${{ github.repository }}:latest
2731
ghcr.io/${{ github.repository }}:${{ github.sha }}
@@ -37,15 +41,27 @@ jobs:
3741

3842
- name: Build binaries
3943
run: |
44+
# Build for each platform
4045
GOOS=linux GOARCH=amd64 go build -o pg-archiver-linux-amd64
4146
GOOS=darwin GOARCH=amd64 go build -o pg-archiver-darwin-amd64
4247
GOOS=darwin GOARCH=arm64 go build -o pg-archiver-darwin-arm64
48+
GOOS=windows GOARCH=amd64 go build -o pg-archiver-windows-amd64.exe
49+
50+
# Set execute permissions
51+
chmod +x pg-archiver-*
52+
53+
# Create compressed archives
54+
tar czf pg-archiver-linux-amd64.tar.gz pg-archiver-linux-amd64
55+
tar czf pg-archiver-darwin-amd64.tar.gz pg-archiver-darwin-amd64
56+
tar czf pg-archiver-darwin-arm64.tar.gz pg-archiver-darwin-arm64
57+
zip pg-archiver-windows-amd64.zip pg-archiver-windows-amd64.exe
4358
4459
- name: Release
4560
uses: softprops/action-gh-release@v1
4661
if: startsWith(github.ref, 'refs/tags/')
4762
with:
4863
files: |
49-
pg-archiver-linux-amd64
50-
pg-archiver-darwin-amd64
51-
pg-archiver-darwin-arm64
64+
pg-archiver-linux-amd64.tar.gz
65+
pg-archiver-darwin-amd64.tar.gz
66+
pg-archiver-darwin-arm64.tar.gz
67+
pg-archiver-windows-amd64.zip

0 commit comments

Comments
 (0)