name: Release on: push: tags: - 'v*' env: GO_VERSION: '1.23' REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: release: name: Create Release runs-on: ubuntu-latest permissions: contents: write packages: write steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: Run tests run: go test -v ./... - name: Build binaries run: | # Linux amd64 GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o bin/gateway-linux-amd64 ./cmd/gateway # Linux arm64 GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o bin/gateway-linux-arm64 ./cmd/gateway # macOS amd64 GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o bin/gateway-darwin-amd64 ./cmd/gateway # macOS arm64 GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o bin/gateway-darwin-arm64 ./cmd/gateway - name: Create checksums run: | cd bin sha256sum gateway-* > checksums.txt - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=raw,value=latest - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - name: Generate changelog id: changelog run: | git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty=format:"* %s (%h)" > CHANGELOG.txt echo "changelog<> $GITHUB_OUTPUT cat CHANGELOG.txt >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Create Release uses: softprops/action-gh-release@v1 with: body: | ## Changes ${{ steps.changelog.outputs.changelog }} ## Docker Images ``` docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ``` ## Installation ### Kubernetes ```bash kubectl apply -k k8s/ ``` ### Docker ```bash docker run -p 8080:8080 \ -e GOOGLE_API_KEY=your-key \ -e ANTHROPIC_API_KEY=your-key \ -e OPENAI_API_KEY=your-key \ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} ``` files: | bin/gateway-* bin/checksums.txt draft: false prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}