Skip to content

Commit 9868d6c

Browse files
adding cloudsmith builds, changing name of workflow
1 parent 1ab6341 commit 9868d6c

File tree

1 file changed

+173
-1
lines changed

1 file changed

+173
-1
lines changed

.github/workflows/ci.yml

Lines changed: 173 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker Image CI
1+
name: CI Builds
22

33
on:
44
workflow_dispatch:
@@ -57,6 +57,178 @@ jobs:
5757
with:
5858
sarif_file: results.sarif
5959

60+
build-linux-packages:
61+
runs-on: ubuntu-22.04
62+
needs: [ gosec ]
63+
if: needs.gosec.result == 'success'
64+
strategy:
65+
matrix:
66+
arch: [ amd64, arm64 ]
67+
68+
permissions:
69+
id-token: write
70+
contents: read
71+
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
76+
- name: Set up Go
77+
uses: actions/setup-go@v5
78+
with:
79+
go-version: '1.24.5'
80+
81+
- name: Build Go Binary
82+
env:
83+
GOOS: linux
84+
GOARCH: ${{ matrix.arch }}
85+
CGO_ENABLED: 0
86+
run: |
87+
go build -ldflags="-s -w -X main.version=${{ env.VERSION_NUMBER }}" -o poke-cli
88+
89+
- name: Install nFPM
90+
run: |
91+
go install github.com/goreleaser/nfpm/v2/cmd/[email protected]
92+
echo "$HOME/go/bin" >> $GITHUB_PATH
93+
94+
- name: Create nFPM Config for Architecture
95+
run: |
96+
# Create architecture-specific config by modifying the base config
97+
sed "s/arch: \"arm64\"/arch: \"${{ matrix.arch }}\"/" nfpm.yaml > nfpm-${{ matrix.arch }}.yaml
98+
99+
- name: Build packages
100+
run: |
101+
# Create output directory
102+
mkdir -p dist
103+
104+
# Build DEB package
105+
nfpm package \
106+
--config nfpm-${{ matrix.arch }}.yaml \
107+
--packager deb \
108+
--target dist/poke-cli_${{ env.VERSION_NUMBER }}_linux_${{ matrix.arch }}.deb
109+
110+
# Build RPM package
111+
nfpm package \
112+
--config nfpm-${{ matrix.arch }}.yaml \
113+
--packager rpm \
114+
--target dist/poke-cli_${{ env.VERSION_NUMBER }}_linux_${{ matrix.arch }}.rpm
115+
116+
# Build APK package
117+
nfpm package \
118+
--config nfpm-${{ matrix.arch }}.yaml \
119+
--packager apk \
120+
--target dist/poke-cli_${{ env.VERSION_NUMBER }}_linux_${{ matrix.arch }}.apk
121+
122+
- name: Upload packages as artifacts
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: linux-packages-${{ matrix.arch }}
126+
path: dist/*
127+
128+
upload-deb-packages:
129+
runs-on: ubuntu-22.04
130+
needs: [ build-linux-packages ]
131+
if: needs.build-linux-packages.result == 'success'
132+
strategy:
133+
matrix:
134+
arch: [ amd64, arm64 ]
135+
fail-fast: false # Don't cancel other uploads if one fails
136+
137+
steps:
138+
- name: Download package artifact
139+
uses: actions/download-artifact@v4
140+
with:
141+
name: linux-packages-${{ matrix.arch }}
142+
path: packages/
143+
144+
- name: Install Cloudsmith CLI
145+
uses: cloudsmith-io/[email protected]
146+
with:
147+
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
148+
149+
- name: Upload DEB to Cloudsmith
150+
working-directory: packages
151+
run: |
152+
cloudsmith push deb \
153+
digitalghost-dev/poke-cli/debian/trixie \
154+
poke-cli_${{ env.VERSION_NUMBER }}_linux_${{ matrix.arch }}.deb
155+
156+
upload-rpm-packages:
157+
runs-on: ubuntu-22.04
158+
needs: [ build-linux-packages ]
159+
if: needs.build-linux-packages.result == 'success'
160+
strategy:
161+
matrix:
162+
arch: [ amd64, arm64 ]
163+
fail-fast: false
164+
165+
steps:
166+
- name: Download package artifact
167+
uses: actions/download-artifact@v4
168+
with:
169+
name: linux-packages-${{ matrix.arch }}
170+
path: packages/
171+
172+
- name: Install Cloudsmith CLI
173+
uses: cloudsmith-io/[email protected]
174+
with:
175+
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
176+
177+
- name: Upload RPM to Cloudsmith
178+
working-directory: packages
179+
run: |
180+
cloudsmith push rpm \
181+
digitalghost-dev/poke-cli/fedora/42 \
182+
poke-cli_${{ env.VERSION_NUMBER }}_linux_${{ matrix.arch }}.rpm
183+
184+
upload-apk-packages:
185+
runs-on: ubuntu-22.04
186+
needs: [ build-linux-packages ]
187+
if: needs.build-linux-packages.result == 'success'
188+
strategy:
189+
matrix:
190+
arch: [ amd64, arm64 ]
191+
fail-fast: false
192+
193+
steps:
194+
- name: Download package artifact
195+
uses: actions/download-artifact@v4
196+
with:
197+
name: linux-packages-${{ matrix.arch }}
198+
path: packages/
199+
200+
- name: Install Cloudsmith CLI
201+
uses: cloudsmith-io/[email protected]
202+
with:
203+
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
204+
205+
- name: Upload APK to Cloudsmith
206+
working-directory: packages
207+
run: |
208+
cloudsmith push alpine \
209+
digitalghost-dev/poke-cli/alpine/v3.22 \
210+
poke-cli_${{ env.VERSION_NUMBER }}_linux_${{ matrix.arch }}.apk
211+
212+
upload-summary:
213+
runs-on: ubuntu-22.04
214+
needs: [ upload-deb-packages, upload-rpm-packages, upload-apk-packages ]
215+
if: always()
216+
217+
steps:
218+
- name: Check all Uploads
219+
run: |
220+
echo "DEB uploads: ${{ needs.upload-deb-packages.result }}"
221+
echo "RPM uploads: ${{ needs.upload-rpm-packages.result }}"
222+
echo "APK uploads: ${{ needs.upload-apk-packages.result }}"
223+
224+
if [ "${{ needs.upload-deb-packages.result }}" != "success" ] || \
225+
[ "${{ needs.upload-rpm-packages.result }}" != "success" ] || \
226+
[ "${{ needs.upload-apk-packages.result }}" != "success" ]; then
227+
echo "⚠️ Some uploads failed! ⚠️"
228+
exit 1
229+
fi
230+
echo "✅ All packages uploaded successfully! ✅"
231+
60232
lint-cli-dockerfile:
61233
runs-on: ubuntu-22.04
62234
needs: [ gosec ]

0 commit comments

Comments
 (0)