Skip to content

Commit 5dbbdb1

Browse files
authored
sync(ci): update GitHub workflows and actions config (#98)
1 parent 8ec42b1 commit 5dbbdb1

36 files changed

Lines changed: 3551 additions & 4744 deletions

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ vendor/
2222
# Binaries for programs and plugins
2323
dist/
2424
!dist/linux/
25+
!dist/linux-amd64/
26+
!dist/linux-arm64/
2527
gin-bin
2628
*.exe
2729
*.exe~

.github/.yamlfmt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#
44
# Purpose: YAML formatting configuration for the mage-x (yamlfmt) tool
55
#
6-
# Maintainer: @mrz1836
7-
#
86
# ------------------------------------------------------------------------------------
97

108
formatter:
@@ -74,6 +72,9 @@ exclude:
7472
- "**/*.swo"
7573
- "**/*~"
7674

75+
# Test fixtures (intentionally malformed YAML used by ci-tester).
76+
- ".github/ci-tester/fixtures/workflow-invalid/.github/workflows/invalid.yml"
77+
7778
# Environment files
7879
- "**/env/**"
7980
- "**/.env.base"

.github/CODEOWNERS

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
.github/scripts/* @mrz1836
1111
.github/workflows/* @mrz1836
1212
.github/env/* @mrz1836
13-
.github/.env.base @mrz1836
14-
.github/.env.custom @mrz1836
1513

1614
# MAGE-X
1715
.mage.yaml @mrz1836
@@ -43,7 +41,7 @@ codecov.yml @mrz1836
4341

4442
# Security and configuration files
4543
.github/SECURITY.md @mrz1836
46-
.github/.gitleaks.toml @mrz1836
44+
.gitleaksignore @mrz1836
4745

4846
# Repository configuration
4947
.github/labels.yml @mrz1836

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ runs:
4646
id: load-env
4747
shell: bash
4848
run: |
49+
set -euo pipefail
4950
echo "📋 Loading environment configuration..."
5051
5152
LOADER_SCRIPT=".github/env/load-env.sh"

.github/actions/setup-goreleaser/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ runs:
105105
# --------------------------------------------------------------------
106106
- name: ✅ Install GoReleaser (cache miss)
107107
if: steps.check-existing.outputs.exists != 'true' && steps.goreleaser-cache.outputs.cache-hit != 'true'
108-
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
108+
uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2
109109
with:
110110
distribution: goreleaser
111111
version: ${{ inputs.goreleaser-version }}

.github/actions/setup-magex/action.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,49 @@ runs:
156156
--pattern "$ASSET_NAME" \
157157
--dir .; then
158158
echo "✅ Download successful"
159-
mv "$ASSET_NAME" mage-x.tar.gz
160159
else
161160
echo "❌ Download failed for $ASSET_NAME from mrz1836/mage-x@$VERSION"
162161
exit 1
163162
fi
164163
164+
# Verify SHA256 integrity against the release's checksums file before extraction.
165+
# Without this, a compromised release asset would silently be executed.
166+
# GoReleaser names the file mage-x_${VERSION}_checksums.txt by default.
167+
CHECKSUMS_FILE="mage-x_${CLEAN_VERSION}_checksums.txt"
168+
echo "🔐 Verifying SHA256 checksum against $CHECKSUMS_FILE..."
169+
if ! gh release download "$VERSION" \
170+
--repo mrz1836/mage-x \
171+
--pattern "$CHECKSUMS_FILE" \
172+
--dir .; then
173+
echo "❌ Failed to download $CHECKSUMS_FILE from mrz1836/mage-x@$VERSION"
174+
echo "❌ Cannot verify binary integrity — refusing to proceed"
175+
exit 1
176+
fi
177+
178+
EXPECTED_HASH=$(grep " ${ASSET_NAME}\$" "$CHECKSUMS_FILE" | awk '{print $1}')
179+
if [[ -z "$EXPECTED_HASH" ]]; then
180+
echo "❌ No checksum entry found for $ASSET_NAME in $CHECKSUMS_FILE"
181+
echo "📋 $CHECKSUMS_FILE contents:"
182+
cat "$CHECKSUMS_FILE"
183+
exit 1
184+
fi
185+
186+
if command -v sha256sum >/dev/null 2>&1; then
187+
ACTUAL_HASH=$(sha256sum "$ASSET_NAME" | awk '{print $1}')
188+
else
189+
ACTUAL_HASH=$(shasum -a 256 "$ASSET_NAME" | awk '{print $1}')
190+
fi
191+
192+
if [[ "$ACTUAL_HASH" != "$EXPECTED_HASH" ]]; then
193+
echo "❌ Checksum mismatch for $ASSET_NAME"
194+
echo " Expected: $EXPECTED_HASH"
195+
echo " Actual: $ACTUAL_HASH"
196+
exit 1
197+
fi
198+
echo "✅ SHA256 checksum verified: $ACTUAL_HASH"
199+
200+
mv "$ASSET_NAME" mage-x.tar.gz
201+
165202
# Extract the tarball
166203
if tar -xzf mage-x.tar.gz; then
167204
echo "✅ Extraction successful"

0 commit comments

Comments
 (0)