feat: new cicd
This commit is contained in:
@@ -1,16 +1,17 @@
|
|||||||
|
# .github/workflows/ci.yml
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, develop ]
|
branches: [main, develop]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, develop ]
|
branches: [main, develop]
|
||||||
|
workflow_call: {} # <-- makes this workflow reusable
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -18,7 +19,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
go-version: "1.21"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,16 +1,23 @@
|
|||||||
|
# .github/workflows/release.yml
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- "v*"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
ci:
|
||||||
|
# Run your CI first and fail fast if tests fail
|
||||||
|
uses: ./.github/workflows/ci.yml
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build and Release
|
name: Build and Release
|
||||||
|
needs: ci
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -20,7 +27,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
go-version: "1.21"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -35,9 +42,9 @@ jobs:
|
|||||||
wl-clipboard \
|
wl-clipboard \
|
||||||
wtype
|
wtype
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag (drop the "v")
|
||||||
id: version
|
id: version
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
env:
|
env:
|
||||||
@@ -49,9 +56,6 @@ jobs:
|
|||||||
go build -ldflags="-s -w" -o hyprvoice-linux-x86_64 ./cmd/hyprvoice
|
go build -ldflags="-s -w" -o hyprvoice-linux-x86_64 ./cmd/hyprvoice
|
||||||
chmod +x hyprvoice-linux-x86_64
|
chmod +x hyprvoice-linux-x86_64
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: go test ./...
|
|
||||||
|
|
||||||
- name: Generate checksums
|
- name: Generate checksums
|
||||||
run: |
|
run: |
|
||||||
sha256sum hyprvoice-linux-x86_64 > hyprvoice-linux-x86_64.sha256
|
sha256sum hyprvoice-linux-x86_64 > hyprvoice-linux-x86_64.sha256
|
||||||
@@ -61,7 +65,8 @@ jobs:
|
|||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.version.outputs.VERSION }}
|
# Use the exact tag that triggered this run
|
||||||
|
tag_name: ${{ github.ref_name }} # e.g., v1.2.3
|
||||||
name: Release ${{ steps.version.outputs.VERSION }}
|
name: Release ${{ steps.version.outputs.VERSION }}
|
||||||
body: |
|
body: |
|
||||||
## Hyprvoice v${{ steps.version.outputs.VERSION }}
|
## Hyprvoice v${{ steps.version.outputs.VERSION }}
|
||||||
@@ -77,7 +82,7 @@ jobs:
|
|||||||
|
|
||||||
**Manual installation:**
|
**Manual installation:**
|
||||||
```bash
|
```bash
|
||||||
wget https://github.com/leonardotrapani/hyprvoice/releases/download/v${{ steps.version.outputs.VERSION }}/hyprvoice-linux-x86_64
|
wget https://github.com/leonardotrapani/hyprvoice/releases/download/${{ github.ref_name }}/hyprvoice-linux-x86_64
|
||||||
chmod +x hyprvoice-linux-x86_64
|
chmod +x hyprvoice-linux-x86_64
|
||||||
mv hyprvoice-linux-x86_64 ~/.local/bin/hyprvoice
|
mv hyprvoice-linux-x86_64 ~/.local/bin/hyprvoice
|
||||||
```
|
```
|
||||||
@@ -90,7 +95,7 @@ jobs:
|
|||||||
- PipeWire audio system
|
- PipeWire audio system
|
||||||
- OpenAI API key for transcription
|
- OpenAI API key for transcription
|
||||||
|
|
||||||
**Full Changelog**: https://github.com/leonardotrapani/hyprvoice/commits/v${{ steps.version.outputs.VERSION }}
|
**Full Changelog**: https://github.com/leonardotrapani/hyprvoice/commits/${{ github.ref_name }}
|
||||||
files: |
|
files: |
|
||||||
./hyprvoice-linux-x86_64
|
./hyprvoice-linux-x86_64
|
||||||
./hyprvoice-linux-x86_64.sha256
|
./hyprvoice-linux-x86_64.sha256
|
||||||
|
|||||||
Reference in New Issue
Block a user