Skip to content

Commit 985d4f7

Browse files
Merge pull request #176 from digitalghost-dev/1.5.2
1.5.2
2 parents ae5ae7a + 9d767fe commit 985d4f7

30 files changed

+2939
-199
lines changed

.github/workflows/ci.yml

Lines changed: 195 additions & 19 deletions
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:
@@ -23,24 +23,27 @@ on:
2323
- 'go.mod'
2424
- 'go.sum'
2525
- '.goreleaser.yaml'
26+
- 'mkdocs.yml'
27+
- 'nfpm.yaml'
2628
- 'pokemon.svg'
2729
branches:
2830
- main
2931

3032
env:
31-
VERSION_NUMBER: 'v1.5.1'
33+
VERSION_NUMBER: 'v1.5.2'
3234
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3335
AWS_REGION: 'us-west-2'
3436

37+
permissions:
38+
actions: read
39+
contents: read
40+
id-token: write
41+
security-events: write
42+
3543
jobs:
3644
gosec:
3745
runs-on: ubuntu-22.04
3846

39-
permissions:
40-
actions: read
41-
contents: read
42-
security-events: write
43-
4447
steps:
4548
- name: Checkout
4649
uses: actions/checkout@v4
@@ -55,11 +58,195 @@ jobs:
5558
with:
5659
sarif_file: results.sarif
5760

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

234+
steps:
235+
- name: Checkout
236+
uses: actions/checkout@v4
237+
238+
- name: Lint Dockerfile
239+
uses: 'hadolint/[email protected]'
240+
with:
241+
dockerfile: Dockerfile
242+
failure-threshold: 'error'
243+
244+
245+
build-docs-docker-image:
246+
runs-on: ubuntu-22.04
247+
needs: [ lint-cli-dockerfile ]
248+
if: needs.lint-cli-dockerfile.result == 'success'
249+
63250
steps:
64251
- name: Checkout
65252
uses: actions/checkout@v4
@@ -123,8 +310,6 @@ jobs:
123310
docker tag docs:latest ${{ secrets.AWS_DOCS_ECR_NAME }}:latest
124311
docker push ${{ secrets.AWS_DOCS_ECR_NAME }}:latest
125312
126-
# AWS will then take care of updating App Runner with the latest version
127-
128313
build-cli-docker-image:
129314
runs-on: ubuntu-22.04
130315
needs: [gosec]
@@ -183,10 +368,6 @@ jobs:
183368
docker push ${{ secrets.AWS_ECR_NAME }}:${{ env.VERSION_NUMBER }}
184369
185370
syft:
186-
permissions:
187-
contents: 'read'
188-
id-token: 'write'
189-
190371
runs-on: ubuntu-22.04
191372
needs: [build-cli-docker-image]
192373
if: needs.build-cli-docker-image.result == 'success'
@@ -219,11 +400,6 @@ jobs:
219400
upload-artifact: true
220401

221402
grype:
222-
permissions:
223-
actions: read
224-
contents: read
225-
security-events: write
226-
227403
runs-on: ubuntu-22.04
228404
needs: [syft]
229405
if: needs.syft.result == 'success'

.github/workflows/go_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Go
1717
uses: actions/setup-go@v5
1818
with:
19-
go-version: 1.23
19+
go-version: '1.24.5'
2020

2121
- name: Install dependencies
2222
run: |

.gitignore

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
.dccache
1010
dist/
1111
poke-cli
12+
*.rpm
13+
*.apk
14+
*.deb
1215

1316
# Test binary, built with `go test -c`
1417
*.test
@@ -32,8 +35,25 @@ card_data/.venv
3235
__pycache__/
3336

3437
# Terraform
35-
card_data/infra/access-token
36-
/card_data/infra/access-token
37-
card_data/infra/secrets.tfvars
38-
card_data/infra/terraform.tfstate
39-
/card_data/infra/.terraform/
38+
### Ignore CLI configuration files
39+
.terraformrc
40+
terraform.rc
41+
42+
**/*.tfvars
43+
**/*.tfvars.json
44+
45+
### Terraform state files
46+
**/*.tfstate
47+
**/*.tfstate.*
48+
49+
### Terraform crash log files
50+
crash.log
51+
crash.*.log
52+
53+
### .terraform
54+
55+
card_data/infrastructure/supabase/access-token
56+
/card_data/infrastructure/supabase/access-token
57+
**/.terraform/
58+
59+
card_data/.tmp*/**

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ builds:
1414
- windows
1515
- darwin
1616
ldflags:
17-
- -s -w -X main.version=v1.5.1
17+
- -s -w -X main.version=v1.5.2
1818

1919
archives:
2020
- formats: [ 'zip' ]

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build 1
2-
FROM golang:1.24.4-alpine3.22 AS build
2+
FROM golang:1.24.5-alpine3.22 AS build
33

44
WORKDIR /app
55

@@ -8,14 +8,13 @@ RUN go mod download
88

99
COPY . .
1010

11-
RUN go build -ldflags "-X main.version=v1.5.1" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v1.5.2" -o poke-cli .
1212

1313
# build 2
1414
FROM --platform=$BUILDPLATFORM alpine:3.22
1515

1616
# Installing only necessary packages and remove them after use
17-
RUN apk upgrade && \
18-
apk add --no-cache shadow && \
17+
RUN apk add --no-cache shadow=4.17.3-r0 && \
1918
addgroup -S poke_group && adduser -S poke_user -G poke_group && \
2019
sed -i 's/^root:.*/root:!*:0:0:root:\/root:\/sbin\/nologin/' /etc/passwd && \
2120
apk del shadow

0 commit comments

Comments
 (0)