diff --git a/.github/workflows/go-autoupdate.yaml b/.github/workflows/go-autoupdate.yaml index 085067f..b775264 100644 --- a/.github/workflows/go-autoupdate.yaml +++ b/.github/workflows/go-autoupdate.yaml @@ -13,6 +13,11 @@ on: required: false type: string default: "release.yml" + lfs: + description: "Enable Git LFS checkout (for repos with large files)" + required: false + type: boolean + default: false jobs: autoupdate: @@ -24,6 +29,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + lfs: ${{ inputs.lfs }} - name: Run workflow prepare script shell: bash diff --git a/.github/workflows/go-pr.yaml b/.github/workflows/go-pr.yaml index 0755334..8d46d1a 100644 --- a/.github/workflows/go-pr.yaml +++ b/.github/workflows/go-pr.yaml @@ -127,6 +127,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + lfs: ${{ inputs.lfs }} - name: Run workflow prepare script shell: bash @@ -197,6 +198,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + lfs: ${{ inputs.lfs }} - name: Run workflow prepare script shell: bash diff --git a/.github/workflows/go-release-cgo.yaml b/.github/workflows/go-release-cgo.yaml index 8ca3d0b..886aa65 100644 --- a/.github/workflows/go-release-cgo.yaml +++ b/.github/workflows/go-release-cgo.yaml @@ -1,258 +1,271 @@ name: Go Release (CGO) on: - workflow_call: - inputs: - go-version: - description: "Go version to use" - required: false - type: string - default: ">=1.24" - semver-config: - description: "Path to semver config file" - required: false - type: string - default: "semver.yaml" - rolling-release-tag: - description: "Create a rolling release tag (e.g., 'v1')" - required: false - type: string - default: "" - # Node.js support (optional) - node-enabled: - description: "Enable Node.js for frontend builds" - required: false - type: boolean - default: false - node-version: - description: "Node.js version to use" - required: false - type: string - default: "20" - node-build-script: - description: "Shell script to build frontend (runs in repo root)" - required: false - type: string - default: "" - node-cache-dependency-path: - description: "Path to package-lock.json for npm caching" - required: false - type: string - default: "package-lock.json" - node-output-path: - description: "Path to frontend build output (for artifact upload)" - required: false - type: string - default: "" - node-embed-path: - description: "Path where frontend should be copied for Go embedding" - required: false - type: string - default: "" - # Platform configuration - platforms: - description: "JSON array of platforms" - required: false - type: string - default: '[{"os":"macos-latest","goos":"darwin","goarch":"arm64","platform":"darwin_arm64"},{"os":"ubuntu-latest","goos":"linux","goarch":"amd64","platform":"linux_amd64"},{"os":"windows-latest","goos":"windows","goarch":"amd64","platform":"windows_amd64"}]' - outputs: - version: - description: "The calculated version (without v prefix)" - value: ${{ jobs.version.outputs.version }} - version_tag: - description: "The version tag (with v prefix)" - value: ${{ jobs.version.outputs.version_tag }} + workflow_call: + inputs: + go-version: + description: "Go version to use" + required: false + type: string + default: ">=1.24" + semver-config: + description: "Path to semver config file" + required: false + type: string + default: "semver.yaml" + rolling-release-tag: + description: "Create a rolling release tag (e.g., 'v1')" + required: false + type: string + default: "" + # Node.js support (optional) + node-enabled: + description: "Enable Node.js for frontend builds" + required: false + type: boolean + default: false + node-version: + description: "Node.js version to use" + required: false + type: string + default: "20" + node-build-script: + description: "Shell script to build frontend (runs in repo root)" + required: false + type: string + default: "" + node-cache-dependency-path: + description: "Path to package-lock.json for npm caching" + required: false + type: string + default: "package-lock.json" + node-output-path: + description: "Path to frontend build output (for artifact upload)" + required: false + type: string + default: "" + node-embed-path: + description: "Path where frontend should be copied for Go embedding" + required: false + type: string + default: "" + # Platform configuration + platforms: + description: "JSON array of platforms" + required: false + type: string + default: '[{"os":"macos-latest","goos":"darwin","goarch":"arm64","platform":"darwin_arm64"},{"os":"ubuntu-latest","goos":"linux","goarch":"amd64","platform":"linux_amd64"},{"os":"windows-latest","goos":"windows","goarch":"amd64","platform":"windows_amd64"}]' + lfs: + description: "Enable Git LFS checkout (for repos with large files)" + required: false + type: boolean + default: false + outputs: + version: + description: "The calculated version (without v prefix)" + value: ${{ jobs.version.outputs.version }} + version_tag: + description: "The version tag (with v prefix)" + value: ${{ jobs.version.outputs.version_tag }} jobs: - test: - name: Test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: ${{ inputs.lfs }} - - name: Run workflow prepare script - shell: bash - run: | - if [ -f "./workflow-prepare.sh" ]; then - chmod +x ./workflow-prepare.sh - ./workflow-prepare.sh - fi + - name: Run workflow prepare script + shell: bash + run: | + if [ -f "./workflow-prepare.sh" ]; then + chmod +x ./workflow-prepare.sh + ./workflow-prepare.sh + fi - - name: Run tests - uses: lukaszraczylo/shared-actions/.github/actions/go-test@main - with: - go-version: ${{ inputs.go-version }} + - name: Run tests + uses: lukaszraczylo/shared-actions/.github/actions/go-test@main + with: + go-version: ${{ inputs.go-version }} - frontend: - name: Build Frontend - if: inputs.node-enabled && inputs.node-build-script != '' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 + frontend: + name: Build Frontend + if: inputs.node-enabled && inputs.node-build-script != '' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + lfs: ${{ inputs.lfs }} - - name: Run workflow prepare script - shell: bash - run: | - if [ -f "./workflow-prepare.sh" ]; then - chmod +x ./workflow-prepare.sh - ./workflow-prepare.sh - fi + - name: Run workflow prepare script + shell: bash + run: | + if [ -f "./workflow-prepare.sh" ]; then + chmod +x ./workflow-prepare.sh + ./workflow-prepare.sh + fi - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-version }} - cache: "npm" - cache-dependency-path: ${{ inputs.node-cache-dependency-path }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: "npm" + cache-dependency-path: ${{ inputs.node-cache-dependency-path }} - - name: Build frontend - shell: bash - run: ${{ inputs.node-build-script }} + - name: Build frontend + shell: bash + run: ${{ inputs.node-build-script }} - - name: Upload frontend artifact - uses: actions/upload-artifact@v4 - with: - name: frontend-dist - path: ${{ inputs.node-output-path }} - retention-days: 1 + - name: Upload frontend artifact + uses: actions/upload-artifact@v4 + with: + name: frontend-dist + path: ${{ inputs.node-output-path }} + retention-days: 1 - version: - name: Calculate Version - needs: test - runs-on: ubuntu-latest - outputs: - version: ${{ steps.semver.outputs.version }} - version_tag: ${{ steps.semver.outputs.version_tag }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + version: + name: Calculate Version + needs: test + runs-on: ubuntu-latest + outputs: + version: ${{ steps.semver.outputs.version }} + version_tag: ${{ steps.semver.outputs.version_tag }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: ${{ inputs.lfs }} - - name: Run workflow prepare script - shell: bash - run: | - if [ -f "./workflow-prepare.sh" ]; then - chmod +x ./workflow-prepare.sh - ./workflow-prepare.sh - fi + - name: Run workflow prepare script + shell: bash + run: | + if [ -f "./workflow-prepare.sh" ]; then + chmod +x ./workflow-prepare.sh + ./workflow-prepare.sh + fi - - name: Calculate version - id: semver - uses: lukaszraczylo/shared-actions/.github/actions/semver@main - with: - config-file: ${{ inputs.semver-config }} + - name: Calculate version + id: semver + uses: lukaszraczylo/shared-actions/.github/actions/semver@main + with: + config-file: ${{ inputs.semver-config }} - build: - name: Build (${{ matrix.platform }}) - needs: [version, frontend] - if: | - always() && - needs.version.result == 'success' && - needs.version.outputs.version_tag != '' && - (needs.frontend.result == 'success' || needs.frontend.result == 'skipped') - strategy: - fail-fast: false - matrix: - include: ${{ fromJson(inputs.platforms) }} - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + build: + name: Build (${{ matrix.platform }}) + needs: [version, frontend] + if: | + always() && + needs.version.result == 'success' && + needs.version.outputs.version_tag != '' && + (needs.frontend.result == 'success' || needs.frontend.result == 'skipped') + strategy: + fail-fast: false + matrix: + include: ${{ fromJson(inputs.platforms) }} + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: ${{ inputs.lfs }} - - name: Run workflow prepare script - shell: bash - env: - TARGET_GOOS: ${{ matrix.goos }} - TARGET_GOARCH: ${{ matrix.goarch }} - run: | - if [ -f "./workflow-prepare.sh" ]; then - chmod +x ./workflow-prepare.sh - ./workflow-prepare.sh - fi + - name: Run workflow prepare script + shell: bash + env: + TARGET_GOOS: ${{ matrix.goos }} + TARGET_GOARCH: ${{ matrix.goarch }} + run: | + if [ -f "./workflow-prepare.sh" ]; then + chmod +x ./workflow-prepare.sh + ./workflow-prepare.sh + fi - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: ${{ inputs.go-version }} - cache: true + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ inputs.go-version }} + cache: true - - name: Download frontend artifact - if: inputs.node-enabled && inputs.node-embed-path != '' - uses: actions/download-artifact@v4 - with: - name: frontend-dist - path: ${{ inputs.node-embed-path }} + - name: Download frontend artifact + if: inputs.node-enabled && inputs.node-embed-path != '' + uses: actions/download-artifact@v4 + with: + name: frontend-dist + path: ${{ inputs.node-embed-path }} - - name: Run GoReleaser (split) - uses: lukaszraczylo/shared-actions/.github/actions/goreleaser@main - with: - version-tag: ${{ needs.version.outputs.version_tag }} - mode: split - cgo-enabled: "1" - github-token: ${{ secrets.GITHUB_TOKEN }} - goreleaser-key: ${{ secrets.GORELEASER_PRO }} + - name: Run GoReleaser (split) + uses: lukaszraczylo/shared-actions/.github/actions/goreleaser@main + with: + version-tag: ${{ needs.version.outputs.version_tag }} + mode: split + cgo-enabled: "1" + github-token: ${{ secrets.GITHUB_TOKEN }} + goreleaser-key: ${{ secrets.GORELEASER_PRO }} - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: release-${{ matrix.platform }} - path: dist/ - retention-days: 1 + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: release-${{ matrix.platform }} + path: dist/ + retention-days: 1 - release: - name: Release - needs: [version, build] - runs-on: ubuntu-latest - permissions: - contents: write - packages: write - id-token: write - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + release: + name: Release + needs: [version, build] + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: ${{ inputs.lfs }} - - name: Run workflow prepare script - shell: bash - run: | - if [ -f "./workflow-prepare.sh" ]; then - chmod +x ./workflow-prepare.sh - ./workflow-prepare.sh - fi + - name: Run workflow prepare script + shell: bash + run: | + if [ -f "./workflow-prepare.sh" ]; then + chmod +x ./workflow-prepare.sh + ./workflow-prepare.sh + fi - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: ${{ inputs.go-version }} + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ inputs.go-version }} - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - path: dist - pattern: release-* - merge-multiple: true + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: dist + pattern: release-* + merge-multiple: true - - name: List artifacts - run: ls -la dist/ + - name: List artifacts + run: ls -la dist/ - - name: Run GoReleaser (merge) - uses: lukaszraczylo/shared-actions/.github/actions/goreleaser@main - with: - version-tag: ${{ needs.version.outputs.version_tag }} - mode: merge - github-token: ${{ secrets.GITHUB_TOKEN }} - goreleaser-key: ${{ secrets.GORELEASER_PRO }} + - name: Run GoReleaser (merge) + uses: lukaszraczylo/shared-actions/.github/actions/goreleaser@main + with: + version-tag: ${{ needs.version.outputs.version_tag }} + mode: merge + github-token: ${{ secrets.GITHUB_TOKEN }} + goreleaser-key: ${{ secrets.GORELEASER_PRO }} - - name: Rolling release - if: inputs.rolling-release-tag != '' - uses: lukaszraczylo/shared-actions/.github/actions/rolling-release@main - with: - tag: ${{ inputs.rolling-release-tag }} - version-tag: ${{ needs.version.outputs.version_tag }} - github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Rolling release + if: inputs.rolling-release-tag != '' + uses: lukaszraczylo/shared-actions/.github/actions/rolling-release@main + with: + tag: ${{ inputs.rolling-release-tag }} + version-tag: ${{ needs.version.outputs.version_tag }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/go-release.yaml b/.github/workflows/go-release.yaml index 4e17c55..0314c87 100644 --- a/.github/workflows/go-release.yaml +++ b/.github/workflows/go-release.yaml @@ -76,6 +76,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + lfs: ${{ inputs.lfs }} - name: Run workflow prepare script shell: bash