Skip to content

Enhance GitHub Copilot Service Proxy with performance optimizations a… #2

Enhance GitHub Copilot Service Proxy with performance optimizations a…

Enhance GitHub Copilot Service Proxy with performance optimizations a… #2

Workflow file for this run

name: Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Get next version
id: version
run: |
# Get the latest tag, if no tags exist, start with v0.0.0
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "Latest tag: $LATEST_TAG"
# Extract version numbers
VERSION=${LATEST_TAG#v}
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION"
MAJOR=${VERSION_PARTS[0]:-0}
MINOR=${VERSION_PARTS[1]:-0}
PATCH=${VERSION_PARTS[2]:-0}
# Increment patch version
PATCH=$((PATCH + 1))
# If this is the first release and we're starting from v0.0.0, set to v0.0.1
if [ "$LATEST_TAG" = "v0.0.0" ]; then
NEW_VERSION="v0.0.1"
else
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
fi
echo "New version: $NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
## Changes in ${{ steps.version.outputs.version }}
Auto-generated release from main branch.
### Downloads
- Linux AMD64: `github-copilot-svcs-linux-amd64`
- Linux ARM64: `github-copilot-svcs-linux-arm64`
- macOS AMD64: `github-copilot-svcs-darwin-amd64`
- macOS ARM64: `github-copilot-svcs-darwin-arm64`
- Windows AMD64: `github-copilot-svcs-windows-amd64.exe`
- Windows ARM64: `github-copilot-svcs-windows-arm64.exe`
draft: false
prerelease: false
build:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: ""
- goos: linux
goarch: arm64
suffix: ""
- goos: darwin
goarch: amd64
suffix: ""
- goos: darwin
goarch: arm64
suffix: ""
- goos: windows
goarch: amd64
suffix: ".exe"
- goos: windows
goarch: arm64
suffix: ".exe"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
BINARY_NAME="github-copilot-svcs-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}"
go build -ldflags="-s -w -X main.version=${{ needs.release.outputs.version }}" -o "$BINARY_NAME" .
# Make the binary executable (important for Unix systems)
chmod +x "$BINARY_NAME"
# Gzip the binary
GZ_BINARY_NAME="$BINARY_NAME.gz"
gzip -c "$BINARY_NAME" > "$GZ_BINARY_NAME"
echo "Built and gzipped binary: $GZ_BINARY_NAME"
ls -la "$GZ_BINARY_NAME"
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./github-copilot-svcs-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}.gz
asset_name: github-copilot-svcs-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}.gz
asset_content_type: application/gzip