# Gitea Actions CI/CD — clip-sync # Lint → Test → Build multi-plateforme → Release # # Triggered on: push to main, tags (v*), pull requests name: CI on: push: branches: [main] tags: ["v*"] pull_request: branches: [main] jobs: # ── Lint ──────────────────────────────────────────────────────────── lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.21" - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: version: latest args: --timeout=3m # ── Test ───────────────────────────────────────────────────────────── test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.21" - name: Install xclip (for clipboard tests) run: sudo apt-get update -qq && sudo apt-get install -y -qq xclip - name: Run tests run: go test ./... -v -count=1 -race -coverprofile=coverage.out -timeout 120s - name: Coverage report run: go tool cover -func=coverage.out # ── Build (cross-compile) ──────────────────────────────────────────── build: name: Build (${{ matrix.os }}/${{ matrix.arch }}) runs-on: ubuntu-latest needs: [lint, test] if: github.event_name == 'push' || github.event_name == 'pull_request' strategy: matrix: os: [linux, windows, darwin] arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.21" - name: Build run: | VERSION="${GITHUB_REF_NAME:-dev}" EXT="" [ "${{ matrix.os }}" = "windows" ] && EXT=".exe" GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} CGO_ENABLED=0 \ go build -ldflags "-s -w -X main.version=${VERSION}" \ -o "clip-sync-${{ matrix.os }}-${{ matrix.arch }}${EXT}" . - name: Upload artifact uses: actions/upload-artifact@v4 with: name: clip-sync-${{ matrix.os }}-${{ matrix.arch }} path: clip-sync-${{ matrix.os }}-${{ matrix.arch }}* # ── Release ────────────────────────────────────────────────────────── release: name: Release runs-on: ubuntu-latest needs: [build] if: startsWith(github.ref, 'refs/tags/v') steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts/ - name: Import GPG key if: ${{ secrets.GPG_PRIVATE_KEY != '' }} env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} run: echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --import - name: Sign artifacts if: ${{ secrets.GPG_PRIVATE_KEY != '' }} env: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} run: | for f in artifacts/*/clip-sync-*; do if [ -n "$GPG_PASSPHRASE" ]; then gpg --batch --yes --pinentry-mode loopback \ --passphrase "$GPG_PASSPHRASE" --armor --detach-sign "$f" else gpg --batch --yes --armor --detach-sign "$f" fi done - name: Create release uses: gitea/action-gitea-release@v1 with: tag_name: ${{ github.ref_name }} name: clip-sync ${{ github.ref_name }} body: | ## clip-sync ${{ github.ref_name }} See [CHANGELOG.md](https://git.dracodev.net/Projets/clip-sync/src/branch/main/CHANGELOG.md) for details. ### Install — Linux / macOS ```bash curl -fsSL https://git.dracodev.net/Projets/clip-sync/raw/branch/main/install.sh | bash ``` ### Install — Windows (PowerShell) ```powershell irm https://git.dracodev.net/Projets/clip-sync/raw/branch/main/install.ps1 | iex ``` Binaries are signed with GPG (`.asc` files) where a signing key is configured. files: | artifacts/**/clip-sync-*