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