release v0.6.8 #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+\.[0-9]+\.[0-9]+' | |
env: | |
IMAGE_NAME: kite | |
GO_VERSION: "1.24.3" | |
NODE_VERSION: "24" | |
jobs: | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
push: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository_owner == 'zxh326' }} | |
permissions: | |
packages: write | |
contents: write | |
outputs: | |
tag_name: ${{ steps.check_version.outputs.tag_name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker hub Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "pnpm" | |
cache-dependency-path: ui/pnpm-lock.yaml | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
- name: Install deps | |
run: make deps | |
- name: Check version | |
id: check_version | |
run: | | |
TAG_NAME=${GITHUB_REF#refs/tags/} | |
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
- name: Build | |
run: make cross-compile | |
- name: Package binaries | |
run: make package-binaries | |
- name: Build and push image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile.binary | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.check_version.outputs.tag_name }} | |
zzde/${{ env.IMAGE_NAME }}:${{ steps.check_version.outputs.tag_name }} | |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest | |
zzde/${{ env.IMAGE_NAME }}:latest | |
labels: runnumber=${{ github.run_id }} | |
- name: Package Helm chart | |
run: | | |
# Package chart | |
helm package charts/kite/ | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.check_version.outputs.tag_name }} | |
name: ${{ steps.check_version.outputs.tag_name }} | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
bin/kite-*-${{ steps.check_version.outputs.tag_name }}.tar.gz | |
kite-*.tgz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update-helm-index: | |
runs-on: ubuntu-latest | |
needs: push | |
if: ${{ github.repository_owner == 'zxh326' && startsWith(github.ref, 'refs/tags/v') }} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
fetch-depth: 0 | |
- name: Download release assets | |
run: | | |
TAG_NAME=${{ needs.push.outputs.tag_name }} | |
VERSION=$(echo $TAG_NAME | sed 's/^v//') | |
# Download the helm chart from the release | |
gh release download $TAG_NAME --pattern "kite-$VERSION.tgz" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update Helm index | |
run: | | |
TAG_NAME=${{ needs.push.outputs.tag_name }} | |
VERSION=$(echo $TAG_NAME | sed 's/^v//') | |
# Set the repository URL for the helm chart | |
REPO_URL="https://github.com/${{ github.repository }}/releases/download/$TAG_NAME" | |
# Update index.yaml | |
if [ -f index.yaml ]; then | |
helm repo index . --url $REPO_URL --merge index.yaml | |
else | |
helm repo index . --url $REPO_URL | |
fi | |
- name: Commit and push index.yaml | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
git add index.yaml | |
if ! git diff --cached --quiet; then | |
git commit -m "Update Helm index for ${{ needs.push.outputs.tag_name }}" | |
git push | |
else | |
echo "No changes to commit" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |