Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Release Build

on:
push:
branches:
- main

permissions:
contents: write

jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-latest
goos: linux
goarch: arm64

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -o duckgres-${{ matrix.goos }}-${{ matrix.goarch }} .

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: duckgres-${{ matrix.goos }}-${{ matrix.goarch }}
path: duckgres-${{ matrix.goos }}-${{ matrix.goarch }}

release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Get short SHA
id: sha
run: echo "short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: build-${{ steps.sha.outputs.short }}
name: Build ${{ steps.sha.outputs.short }}
body: |
Automated build from commit ${{ github.sha }}
files: |
artifacts/duckgres-linux-amd64/duckgres-linux-amd64
artifacts/duckgres-linux-arm64/duckgres-linux-arm64

- name: Delete existing latest release
run: gh release delete latest --yes || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update latest tag
run: |
git tag -f latest
git push -f origin latest

- name: Create latest release
uses: softprops/action-gh-release@v2
with:
tag_name: latest
name: Latest Build
body: |
Latest build from commit ${{ github.sha }}

For a stable URL, use:
```
https://github.com/PostHog/duckgres/releases/latest/download/duckgres-linux-amd64
https://github.com/PostHog/duckgres/releases/latest/download/duckgres-linux-arm64
```
files: |
artifacts/duckgres-linux-amd64/duckgres-linux-amd64
artifacts/duckgres-linux-arm64/duckgres-linux-arm64
Loading