feat: add node-list page #268
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: CI | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [main] | |
paths: | |
- "**/*.go" | |
- "**/*.ts" | |
- "**/*.tsx" | |
- "**/*.css" | |
- "go.mod" | |
- "ui/package.json" | |
- "ui/vite.config.ts" | |
- "ui/tsconfig*.json" | |
- "ui/eslint.config.js" | |
- "Dockerfile*" | |
pull_request: | |
branches: [main] | |
paths: | |
- "**/*.go" | |
- "**/*.ts" | |
- "**/*.tsx" | |
- "**/*.css" | |
- ".github/workflows/ci.yml" | |
- "go.mod" | |
- "ui/package.json" | |
- "ui/vite.config.ts" | |
- "ui/tsconfig*.json" | |
- "ui/eslint.config.js" | |
- "Dockerfile*" | |
env: | |
GO_VERSION: "1.24.3" | |
NODE_VERSION: "24" | |
jobs: | |
ci: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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: Build | |
run: make build | |
- name: lint | |
run: make pre-commit | |
- name: Test | |
run: make test | |
docker: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
needs: ci | |
if: success() | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- 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: Generate tags | |
id: tags | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
echo "tags=zzde/kite:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
echo "image_tag=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
else | |
echo "tags=zzde/kite:main" >> $GITHUB_OUTPUT | |
echo "image_tag=main" >> $GITHUB_OUTPUT | |
fi | |
- name: Build | |
run: make cross-compile | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile.binary | |
push: true | |
tags: ${{ steps.tags.outputs.tags }} | |
labels: runnumber=${{ github.run_id }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64,linux/arm64 | |
- name: Comment PR with image info | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const imageTag = '${{ steps.tags.outputs.image_tag }}'; | |
const imageName = 'zzde/kite:' + imageTag; | |
// Get image size from Docker Hub API | |
let imageSize = 'Unknown'; | |
try { | |
const response = await fetch(`https://hub.docker.com/v2/repositories/zzde/kite/tags/${imageTag}`); | |
if (response.ok) { | |
const data = await response.json(); | |
const sizeBytes = data.full_size; | |
if (sizeBytes) { | |
imageSize = (sizeBytes / 1024 / 1024).toFixed(1) + ' MB'; | |
} | |
} | |
} catch (error) { | |
console.log('Could not fetch image size:', error); | |
} | |
const commentBody = `🐳 Docker image built successfully!\n\n**Image:** \`${imageName}\`\n\n**Size:** ${imageSize}`; | |
// Find existing comment | |
const { data: comments } = await github.rest.issues.listComments({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number | |
}); | |
const existingComment = comments.find(comment => | |
comment.user.type === 'Bot' && | |
comment.body.includes('🐳 Docker image built successfully!') | |
); | |
if (existingComment) { | |
// Update existing comment | |
await github.rest.issues.updateComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: existingComment.id, | |
body: commentBody | |
}); | |
} else { | |
// Create new comment | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: commentBody | |
}); | |
} |