Skip to content

Commit 46aec71

Browse files
committed
ci: kcl musl release package
Signed-off-by: Peefy <[email protected]>
1 parent b88745b commit 46aec71

File tree

2 files changed

+64
-8
lines changed

2 files changed

+64
-8
lines changed

.github/workflows/example-e2e-tests.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,3 @@ jobs:
9696

9797
- name: e2e tests
9898
run: PATH=$PATH:$HOME/go/bin kcl ./examples/kubernetes.k
99-
100-
- name: Example tests
101-
shell: bash -ieo pipefail {0}
102-
run: PATH=$PATH:$HOME/go/bin ./examples/test.sh
103-
104-
- name: Run concurrent e2e tests
105-
shell: bash -ieo pipefail {0}
106-
run: PATH=$PATH:$HOME/go/bin ./scripts/concurrent_test.sh

.github/workflows/release.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,67 @@ jobs:
8080
args: release --clean
8181
env:
8282
GITHUB_TOKEN: ${{ secrets.DEPLOY_ACCESS_TOKEN }}
83+
84+
musl-binary:
85+
needs: binary
86+
runs-on: ubuntu-latest
87+
container: golang:1.24-alpine
88+
steps:
89+
- name: Git checkout
90+
uses: actions/checkout@v6
91+
92+
- name: Install musl dependencies (Alpine container)
93+
run: |
94+
apk add --no-cache \
95+
musl-dev \
96+
gcc \
97+
git \
98+
make \
99+
linux-headers \
100+
tar
101+
102+
- name: Compile KCL (musl static build)
103+
run: |
104+
CGO_ENABLED=1 go build -tags="musl netgo static osusergo" -ldflags="-linkmode external -extldflags '-static'" ./cmd/kcl
105+
env:
106+
CGO_LDFLAGS: '-static'
107+
108+
- name: Package musl binary with docs
109+
run: |
110+
TAG_NAME=${{ github.ref_name }}
111+
mkdir -p kcl-musl-package
112+
cp -f ./kcl ./kcl-musl-package/
113+
cp -f ./README.md ./kcl-musl-package/
114+
cp -f ./LICENSE ./kcl-musl-package/
115+
tar -czf kcl-${TAG_NAME}-linux-musl-amd64.tar.gz -C kcl-musl-package .
116+
ls -lh kcl-${TAG_NAME}-linux-musl-amd64.tar.gz
117+
echo "PACKAGE_NAME=kcl-${TAG_NAME}-linux-musl-amd64.tar.gz" >> $GITHUB_ENV
118+
119+
- name: Upload musl package to Artifact
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: kcl-musl-package
123+
path: ./${{ env.PACKAGE_NAME }}
124+
retention-days: 7
125+
126+
upload-musl-to-release:
127+
needs: [binary, musl-binary]
128+
runs-on: ubuntu-latest
129+
steps:
130+
- name: Download musl package from Artifact
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: kcl-musl-package
134+
path: ./
135+
136+
- name: Install GitHub CLI
137+
run: |
138+
sudo apt update && sudo apt install -y gh
139+
140+
- name: Upload to GitHub Release
141+
run: |
142+
echo "${{ secrets.DEPLOY_ACCESS_TOKEN }}" | gh auth login --with-token
143+
PACKAGE_NAME=$(ls ./kcl-*.tar.gz)
144+
gh release upload "${{ github.ref_name }}" "${PACKAGE_NAME}" --clobber
145+
env:
146+
GITHUB_API_URL: https://api.github.com

0 commit comments

Comments
 (0)