Skip to content

Commit 0066d74

Browse files
authored
sync(ci): update GitHub Actions workflows and env configs (#12)
1 parent 7d0aa93 commit 0066d74

20 files changed

+161
-37
lines changed

.github/actions/parse-env/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ runs:
3636
# --------------------------------------------------------------------
3737
- name: 🔧 Parse environment variables
3838
shell: bash
39+
env:
40+
ENV_JSON: ${{ inputs.env-json }}
3941
run: |
4042
echo "📋 Setting environment variables..."
4143
42-
# Get the input JSON
43-
ENV_JSON='${{ inputs.env-json }}'
44-
4544
# Validate JSON format before processing
4645
if ! echo "$ENV_JSON" | jq empty 2>/dev/null; then
4746
echo "❌ ERROR: Invalid JSON format in env-json input!" >&2

.github/actions/setup-go-with-cache/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ inputs:
4747
description: "Enable multi-module mode - uses pattern **/go.sum to hash all go.sum files for cache keys, skips root go.sum validation"
4848
required: false
4949
default: "false"
50+
github-token:
51+
description: "GitHub token for private module authentication (only used when GOPRIVATE is set in environment)"
52+
required: false
53+
default: ""
5054

5155
outputs:
5256
go-version-actual:
@@ -443,6 +447,29 @@ runs:
443447
go-version: ${{ inputs.go-version }}
444448
cache: false # we handle caches ourselves
445449

450+
# --------------------------------------------------------------------
451+
# Configure git authentication for private Go modules (conditional)
452+
# Only runs when GOPRIVATE is set AND a github-token is provided
453+
# --------------------------------------------------------------------
454+
- name: 🔐 Configure private module authentication
455+
if: ${{ inputs.github-token != '' && env.GOPRIVATE != '' }}
456+
shell: bash
457+
env:
458+
PRIVATE_MODULE_TOKEN: ${{ inputs.github-token }}
459+
run: |
460+
echo "🔐 Configuring git authentication for private Go modules..."
461+
echo "📋 GOPRIVATE=$GOPRIVATE"
462+
463+
# Configure git to use the token for HTTPS URLs
464+
git config --global url."https://x-access-token:${PRIVATE_MODULE_TOKEN}@github.com/".insteadOf "https://github.com/"
465+
466+
# Set GONOSUMDB to match GOPRIVATE if not explicitly set
467+
if [ -z "$GONOSUMDB" ]; then
468+
echo "GONOSUMDB=$GOPRIVATE" >> $GITHUB_ENV
469+
fi
470+
471+
echo "✅ Private module authentication configured"
472+
446473
# --------------------------------------------------------------------
447474
# Summary and validation
448475
# --------------------------------------------------------------------

.github/actions/warm-cache/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ inputs:
5353
description: "Enable multi-module mode - uses hash of all go.sum files for cache keys"
5454
required: false
5555
default: "false"
56+
github-token:
57+
description: "GitHub token for private module authentication (only used when GOPRIVATE is set)"
58+
required: false
59+
default: ""
5660

5761
runs:
5862
using: "composite"
@@ -96,6 +100,7 @@ runs:
96100
go-secondary-version: ${{ inputs.go-secondary-version }}
97101
go-sum-file: ${{ inputs.go-sum-file }}
98102
enable-multi-module: ${{ inputs.enable-multi-module }}
103+
github-token: ${{ inputs.github-token }}
99104

100105
# ────────────────────────────────────────────────────────────────────────────
101106
# Setup MAGE-X (required for magex commands in cache warming)

.github/env/00-core.env

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ GO_PRIMARY_VERSION=1.24.x
2929
GO_SECONDARY_VERSION=1.24.x
3030

3131
# Govulncheck-specific Go version for vulnerability scanning
32-
GOVULNCHECK_GO_VERSION=1.26.0
32+
GOVULNCHECK_GO_VERSION=1.26.1
3333

3434
# ================================================================================================
3535
# 📦 GO MODULE CONFIGURATION
@@ -41,6 +41,13 @@ GO_SUM_FILE=go.sum
4141
# Multi-module monorepo support
4242
ENABLE_MULTI_MODULE_TESTING=false
4343

44+
# Private Go module support (opt-in)
45+
# Set GOPRIVATE in 90-project.env to enable private module authentication
46+
# Example: github.com/myorg/*,github.com/otherorg/*
47+
GOPRIVATE=
48+
GONOSUMCHECK=
49+
GONOSUMDB=
50+
4451
# ================================================================================================
4552
# 🖥️ RUNNER CONFIGURATION
4653
# ================================================================================================

.github/env/10-mage-x.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# ================================================================================================
3737

3838
# MAGE-X version
39-
MAGE_X_VERSION=v1.20.7
39+
MAGE_X_VERSION=v1.20.8
4040

4141
# For mage-x development, set to 'true' to use local version instead of downloading from releases
4242
MAGE_X_USE_LOCAL=false
@@ -61,8 +61,8 @@ MAGE_X_FORMAT_EXCLUDE_PATHS=vendor,node_modules,.git,.idea
6161

6262
MAGE_X_GITLEAKS_VERSION=8.30.0
6363
MAGE_X_GOFUMPT_VERSION=v0.9.2
64-
MAGE_X_GOLANGCI_LINT_VERSION=v2.10.1
65-
MAGE_X_GORELEASER_VERSION=v2.14.1
64+
MAGE_X_GOLANGCI_LINT_VERSION=v2.11.2
65+
MAGE_X_GORELEASER_VERSION=v2.14.2
6666
MAGE_X_GOVULNCHECK_VERSION=v1.1.4
6767
MAGE_X_GO_SECONDARY_VERSION=1.24.x
6868
MAGE_X_GO_VERSION=1.24.x
@@ -72,7 +72,7 @@ MAGE_X_STATICCHECK_VERSION=2026.1
7272
MAGE_X_SWAG_VERSION=v1.16.6
7373
MAGE_X_YAMLFMT_VERSION=v0.21.0
7474
MAGE_X_BENCHSTAT_VERSION=v0.0.0-20260211190930-8161c38c6cdc
75-
MAGE_X_MAGE_VERSION=v1.15.0
75+
MAGE_X_MAGE_VERSION=v1.16.0
7676

7777
# ================================================================================================
7878
# 📝 RUNTIME VARIABLES (set by setup-goreleaser action)

.github/env/10-pre-commit.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# 🪝 PRE-COMMIT TOOL VERSION
2727
# ================================================================================================
2828

29-
GO_PRE_COMMIT_VERSION=v1.6.2
29+
GO_PRE_COMMIT_VERSION=v1.8.0
3030
GO_PRE_COMMIT_USE_LOCAL=false
3131

3232
# ================================================================================================
@@ -52,7 +52,7 @@ GO_PRE_COMMIT_ALL_FILES=true
5252
# 🛠️ TOOL VERSIONS
5353
# ================================================================================================
5454

55-
GO_PRE_COMMIT_GOLANGCI_LINT_VERSION=v2.10.1
55+
GO_PRE_COMMIT_GOLANGCI_LINT_VERSION=v2.11.2
5656
GO_PRE_COMMIT_FUMPT_VERSION=v0.9.2
5757
GO_PRE_COMMIT_GOIMPORTS_VERSION=latest
5858
GO_PRE_COMMIT_GITLEAKS_VERSION=v8.30.0

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
49+
uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
5050
with:
5151
languages: ${{ matrix.language }}
5252
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -57,7 +57,7 @@ jobs:
5757
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5858
# If this step fails, then you should remove it and run the build manually (see below)
5959
- name: Autobuild
60-
uses: github/codeql-action/autobuild@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
60+
uses: github/codeql-action/autobuild@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
6161

6262
# ℹ️ Command-line programs to run using the OS shell.
6363
# 📚 https://git.io/JvXDl
@@ -67,4 +67,4 @@ jobs:
6767
# uses a compiled language
6868

6969
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
70+
uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6

.github/workflows/fortress-benchmarks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ jobs:
144144
go-secondary-version: ${{ inputs.go-secondary-version }}
145145
go-sum-file: ${{ inputs.go-sum-file }}
146146
enable-multi-module: ${{ env.ENABLE_MULTI_MODULE_TESTING }}
147+
github-token: ${{ secrets.github-token }}
147148

148149
# --------------------------------------------------------------------
149150
# Extract Go module directory from GO_SUM_FILE path

.github/workflows/fortress-code-quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ jobs:
9494
go-secondary-version: ${{ inputs.go-primary-version }}
9595
go-sum-file: ${{ env.GO_SUM_FILE }}
9696
enable-multi-module: ${{ env.ENABLE_MULTI_MODULE_TESTING }}
97+
github-token: ${{ secrets.github-token }}
9798

9899
# --------------------------------------------------------------------
99100
# Extract Go module directory from GO_SUM_FILE path
@@ -316,6 +317,7 @@ jobs:
316317
go-secondary-version: ${{ inputs.go-primary-version }}
317318
go-sum-file: ${{ env.GO_SUM_FILE }}
318319
enable-multi-module: ${{ env.ENABLE_MULTI_MODULE_TESTING }}
320+
github-token: ${{ secrets.github-token }}
319321

320322
# --------------------------------------------------------------------
321323
# Extract Go module directory from GO_SUM_FILE path
@@ -596,6 +598,7 @@ jobs:
596598
go-secondary-version: ${{ inputs.go-primary-version }}
597599
go-sum-file: ${{ env.GO_SUM_FILE }}
598600
enable-multi-module: ${{ env.ENABLE_MULTI_MODULE_TESTING }}
601+
github-token: ${{ secrets.github-token }}
599602

600603
# --------------------------------------------------------------------
601604
# Extract Go module directory from GO_SUM_FILE path

.github/workflows/fortress-coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ jobs:
176176
go-secondary-version: ${{ env.GO_SECONDARY_VERSION }}
177177
go-sum-file: ${{ inputs.go-sum-file }}
178178
enable-multi-module: ${{ env.ENABLE_MULTI_MODULE_TESTING }}
179+
github-token: ${{ secrets.github-token }}
179180

180181
# --------------------------------------------------------------------
181182
# Extract Go module directory from GO_SUM_FILE path

0 commit comments

Comments
 (0)