Set up github action.

This commit is contained in:
2025-12-10 21:34:25 +00:00
parent 1fba795fba
commit 9b7e07b3c6
8 changed files with 122 additions and 83 deletions
@@ -10,7 +10,7 @@ jobs:
analyze: analyze:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: write
pages: write pages: write
id-token: write id-token: write
@@ -19,11 +19,22 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Run Git Velocity Analysis - name: Run Git Velocity Analysis
uses: lukaszraczylo/git-velocity/.github/actions/git-velocity@main uses: lukaszraczylo/git-velocity@v1
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
config_file: '.git-velocity.yaml' config_file: '.git-velocity.yaml'
output_dir: './dist' output_dir: './dist'
deploy_gh_pages: 'true'
upload_artifact: 'true' - name: Upload artifact
artifact_name: 'velocity-dashboard' uses: actions/upload-artifact@v4
with:
name: velocity-dashboard
path: ./dist
retention-days: 30
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
force_orphan: true
+14 -42
View File
@@ -1,9 +1,14 @@
name: Release name: Test, build, release
on: on:
workflow_dispatch:
push: push:
tags: paths-ignore:
- 'v*' - '**.md'
- '**/release.yml'
- 'action.yml'
branches:
- main
permissions: permissions:
contents: write contents: write
@@ -11,42 +16,9 @@ permissions:
jobs: jobs:
release: release:
runs-on: ubuntu-latest uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main
steps: with:
- uses: actions/checkout@v4 go-version: "1.24"
with: docker-enabled: true
fetch-depth: 0 rolling-release-tag: "v1"
secrets: inherit
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Vue SPA
working-directory: web
run: |
npm ci
npm run build
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
+8 -11
View File
@@ -69,24 +69,21 @@ dockers_v2:
platforms: platforms:
- linux/amd64 - linux/amd64
- linux/arm64 - linux/arm64
dockerfile: Dockerfile dockerfile: Dockerfile.goreleaser
extra_files: extra_files:
- config.example.yaml - config.example.yaml
homebrew_casks: brews:
- name: git-velocity - name: git-velocity
repository: repository:
owner: lukaszraczylo owner: lukaszraczylo
name: homebrew-taps name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
directory: Casks directory: Formula
homepage: https://github.com/lukaszraczylo/git-velocity homepage: https://github.com/lukaszraczylo/git-velocity
description: "Developer velocity metrics analyzer with gamification dashboards" description: "Developer velocity metrics analyzer with gamification dashboards"
license: MIT license: MIT
hooks: install: |
post: bin.install "git-velocity"
install: | test: |
if OS.mac? system "#{bin}/git-velocity", "version"
system_command "/usr/bin/xattr",
args: ["-dr", "com.apple.quarantine", "#{staged_path}/git-velocity"]
end
+14
View File
@@ -0,0 +1,14 @@
FROM alpine:3.21
ARG TARGETPLATFORM
RUN apk add --no-cache ca-certificates tzdata git
COPY ${TARGETPLATFORM}/git-velocity /usr/local/bin/git-velocity
COPY config.example.yaml /etc/git-velocity/config.example.yaml
RUN chmod +x /usr/local/bin/git-velocity
WORKDIR /workspace
ENTRYPOINT ["/usr/local/bin/git-velocity"]
CMD ["--help"]
+17 -8
View File
@@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://img.icons8.com/fluency/96/rocket.png" alt="Git Velocity Logo" width="96" height="96"/> <img src="docs/git-velocity-logo.png" alt="Git Velocity Logo" width="200"/>
</p> </p>
<h1 align="center">Git Velocity</h1> <h1 align="center">Git Velocity</h1>
@@ -160,14 +160,23 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Run Git Velocity Analysis - name: Run Git Velocity Analysis
uses: lukaszraczylo/git-velocity/.github/actions/git-velocity@main uses: lukaszraczylo/git-velocity@v1
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
config_file: '.git-velocity.yaml' config_file: '.git-velocity.yaml'
output_dir: './velocity-report' output_dir: './velocity-report'
deploy_gh_pages: 'true'
upload_artifact: 'true' - name: Upload artifact
artifact_name: 'velocity-dashboard' uses: actions/upload-artifact@v4
with:
name: velocity-dashboard
path: ./velocity-report
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./velocity-report
``` ```
### Action Inputs ### Action Inputs
@@ -177,9 +186,7 @@ jobs:
| `github_token` | GitHub token for API access | **Required** | | `github_token` | GitHub token for API access | **Required** |
| `config_file` | Path to configuration file | `.git-velocity.yaml` | | `config_file` | Path to configuration file | `.git-velocity.yaml` |
| `output_dir` | Output directory for dashboard | `./dist` | | `output_dir` | Output directory for dashboard | `./dist` |
| `deploy_gh_pages` | Deploy to GitHub Pages | `false` | | `verbose` | Enable verbose output | `false` |
| `upload_artifact` | Upload as workflow artifact | `true` |
| `artifact_name` | Name for the artifact | `git-velocity-dashboard` |
### Action Outputs ### Action Outputs
@@ -187,6 +194,8 @@ jobs:
|--------|-------------| |--------|-------------|
| `output_dir` | Path to the generated dashboard | | `output_dir` | Path to the generated dashboard |
> **Note**: The action runs as a Docker container for fast execution. Use separate steps for artifact upload and GitHub Pages deployment as shown in the example above.
## 🏆 Achievements ## 🏆 Achievements
Git Velocity includes 34 unlockable achievements: Git Velocity includes 34 unlockable achievements:
+37
View File
@@ -0,0 +1,37 @@
# action.yml
name: 'Git Velocity Analyser'
description: 'Analyze Git repositories for developer velocity metrics and generate beautiful dashboards'
author: 'Lukasz Raczylo'
branding:
icon: 'activity'
color: 'purple'
inputs:
github_token:
description: 'GitHub token for API access'
required: true
config_file:
description: 'Path to configuration file'
required: false
default: '.git-velocity.yaml'
output_dir:
description: 'Output directory for generated dashboard'
required: false
default: './dist'
verbose:
description: 'Enable verbose output'
required: false
default: 'false'
outputs:
output_dir:
description: 'Path to the generated dashboard'
runs:
using: 'docker'
image: 'docker://ghcr.io/lukaszraczylo/git-velocity:latest'
args:
- analyze
- --config
- ${{ inputs.config_file }}
- --output
- ${{ inputs.output_dir }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

+16 -17
View File
@@ -109,9 +109,8 @@
<nav class="fixed w-full glass shadow-modern z-50 theme-transition"> <nav class="fixed w-full glass shadow-modern z-50 theme-transition">
<div class="max-w-6xl mx-auto px-4 sm:px-6"> <div class="max-w-6xl mx-auto px-4 sm:px-6">
<div class="flex justify-between h-16 items-center"> <div class="flex justify-between h-16 items-center">
<a href="#" class="flex items-center hover:opacity-80 transition-opacity duration-300 gap-2"> <a href="#" class="flex items-center hover:opacity-80 transition-opacity duration-300">
<i class="fas fa-rocket text-2xl gradient-text"></i> <img src="git-velocity-logo.png" alt="Git Velocity" class="h-8 w-auto" />
<span class="text-xl font-bold gradient-text">git-velocity</span>
</a> </a>
<div class="hidden md:flex space-x-6"> <div class="hidden md:flex space-x-6">
<a href="#features" class="text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100 font-medium">Features</a> <a href="#features" class="text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100 font-medium">Features</a>
@@ -156,9 +155,7 @@
<div class="relative max-w-6xl mx-auto px-4 sm:px-6"> <div class="relative max-w-6xl mx-auto px-4 sm:px-6">
<div class="text-center"> <div class="text-center">
<div class="mb-8 sm:mb-10 flex justify-center animate-fade-in-up"> <div class="mb-8 sm:mb-10 flex justify-center animate-fade-in-up">
<div class="text-8xl sm:text-9xl animate-float"> <img src="git-velocity-logo.png" alt="Git Velocity Logo" class="w-64 sm:w-80 md:w-96 h-auto animate-float" />
<i class="fas fa-rocket gradient-text"></i>
</div>
</div> </div>
<h1 class="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-gray-100 mb-4 sm:mb-6 leading-tight animate-fade-in-up" style="animation-delay: 0.1s;"> <h1 class="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-gray-100 mb-4 sm:mb-6 leading-tight animate-fade-in-up" style="animation-delay: 0.1s;">
Turn Your GitHub Activity<br /><span class="gradient-text">Into a Game</span> Turn Your GitHub Activity<br /><span class="gradient-text">Into a Game</span>
@@ -571,13 +568,17 @@
- <span class="text-blue-400">uses:</span> actions/checkout@v4 - <span class="text-blue-400">uses:</span> actions/checkout@v4
- <span class="text-blue-400">name:</span> Run Git Velocity Analysis - <span class="text-blue-400">name:</span> Run Git Velocity Analysis
<span class="text-blue-400">uses:</span> lukaszraczylo/git-velocity/.github/actions/git-velocity@main <span class="text-blue-400">uses:</span> lukaszraczylo/git-velocity@v1
<span class="text-blue-400">with:</span> <span class="text-blue-400">with:</span>
<span class="text-green-400">github_token:</span> ${{ secrets.GITHUB_TOKEN }} <span class="text-green-400">github_token:</span> ${{ secrets.GITHUB_TOKEN }}
<span class="text-green-400">config_file:</span> '.git-velocity.yaml' <span class="text-green-400">config_file:</span> '.git-velocity.yaml'
<span class="text-green-400">output_dir:</span> './velocity-report' <span class="text-green-400">output_dir:</span> './velocity-report'
<span class="text-green-400">deploy_gh_pages:</span> 'true'
<span class="text-green-400">upload_artifact:</span> 'true'</code></pre> - <span class="text-blue-400">name:</span> Deploy to GitHub Pages
<span class="text-blue-400">uses:</span> peaceiris/actions-gh-pages@v4
<span class="text-blue-400">with:</span>
<span class="text-green-400">github_token:</span> ${{ secrets.GITHUB_TOKEN }}
<span class="text-green-400">publish_dir:</span> ./velocity-report</code></pre>
</div> </div>
<div class="grid sm:grid-cols-2 gap-4"> <div class="grid sm:grid-cols-2 gap-4">
<div class="glass p-4 rounded-xl"> <div class="glass p-4 rounded-xl">
@@ -588,8 +589,7 @@
<li><code class="text-pink-600 dark:text-pink-400">github_token</code> - API access (required)</li> <li><code class="text-pink-600 dark:text-pink-400">github_token</code> - API access (required)</li>
<li><code class="text-pink-600 dark:text-pink-400">config_file</code> - Config path</li> <li><code class="text-pink-600 dark:text-pink-400">config_file</code> - Config path</li>
<li><code class="text-pink-600 dark:text-pink-400">output_dir</code> - Output directory</li> <li><code class="text-pink-600 dark:text-pink-400">output_dir</code> - Output directory</li>
<li><code class="text-pink-600 dark:text-pink-400">deploy_gh_pages</code> - Auto-deploy</li> <li><code class="text-pink-600 dark:text-pink-400">verbose</code> - Verbose output</li>
<li><code class="text-pink-600 dark:text-pink-400">upload_artifact</code> - Save artifact</li>
</ul> </ul>
</div> </div>
<div class="glass p-4 rounded-xl"> <div class="glass p-4 rounded-xl">
@@ -602,9 +602,9 @@
<div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-600"> <div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-600">
<h5 class="font-medium text-gray-900 dark:text-gray-100 mb-2">Features</h5> <h5 class="font-medium text-gray-900 dark:text-gray-100 mb-2">Features</h5>
<ul class="text-sm text-gray-600 dark:text-gray-400 space-y-1"> <ul class="text-sm text-gray-600 dark:text-gray-400 space-y-1">
<li><i class="fas fa-check text-green-500 mr-2"></i>Auto GitHub Pages deploy</li> <li><i class="fas fa-check text-green-500 mr-2"></i>Docker-based (fast startup)</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Artifact retention (30 days)</li> <li><i class="fas fa-check text-green-500 mr-2"></i>Multi-arch (amd64/arm64)</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Go 1.23 + Node 20</li> <li><i class="fas fa-check text-green-500 mr-2"></i>Pre-built image from GHCR</li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -755,9 +755,8 @@
<footer class="py-8 bg-gray-100 dark:bg-gray-800 theme-transition"> <footer class="py-8 bg-gray-100 dark:bg-gray-800 theme-transition">
<div class="max-w-6xl mx-auto px-4 sm:px-6"> <div class="max-w-6xl mx-auto px-4 sm:px-6">
<div class="flex flex-col sm:flex-row justify-between items-center gap-4"> <div class="flex flex-col sm:flex-row justify-between items-center gap-4">
<div class="flex items-center gap-2"> <div class="flex items-center">
<i class="fas fa-rocket text-xl gradient-text"></i> <img src="git-velocity-logo.png" alt="Git Velocity" class="h-6 w-auto" />
<span class="font-semibold gradient-text">git-velocity</span>
</div> </div>
<div class="flex items-center gap-6"> <div class="flex items-center gap-6">
<a href="https://github.com/lukaszraczylo/git-velocity" class="text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"> <a href="https://github.com/lukaszraczylo/git-velocity" class="text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100">