Skip to content

Commit 58bdab9

Browse files
authored
Merge pull request #2 from jethome-iot/copilot/add-cosign-signing-docker-images
Add cosign signing for Docker images
2 parents 06f3ab9 + 36de032 commit 58bdab9

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

.github/workflows/platformio.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
permissions:
4040
contents: read
4141
packages: write
42+
id-token: write
4243

4344
steps:
4445
- name: Checkout repository
@@ -112,6 +113,7 @@ jobs:
112113
fi
113114
114115
- name: Build and push Docker image
116+
id: build-and-push
115117
uses: docker/build-push-action@v5
116118
with:
117119
context: images/platformio
@@ -120,4 +122,20 @@ jobs:
120122
labels: ${{ steps.meta.outputs.labels }}
121123
cache-from: ${{ steps.cache.outputs.CACHE_FROM }}
122124
cache-to: ${{ steps.cache.outputs.CACHE_TO }}
123-
platforms: linux/amd64,linux/arm64
125+
platforms: linux/amd64,linux/arm64
126+
127+
- name: Install Cosign
128+
if: github.event_name != 'pull_request'
129+
uses: sigstore/cosign-installer@v3.5.0
130+
131+
- name: Sign the published Docker image
132+
if: github.event_name != 'pull_request'
133+
env:
134+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
135+
TAGS: ${{ steps.tags.outputs.TAGS }}
136+
run: |
137+
images=""
138+
for tag in ${TAGS//,/ }; do
139+
images+="${tag}@${DIGEST} "
140+
done
141+
cosign sign --yes ${images}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Images are automatically built and published to GHCR when:
3535

3636
Each image has its own GitHub Actions workflow that only triggers when relevant files change.
3737

38+
All published images are signed using [Cosign](https://github.com/sigstore/cosign) with keyless signing for enhanced security and supply chain integrity.
39+
3840
## License
3941

4042
MIT License - see [LICENSE](LICENSE) file for details.

images/platformio/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ pio run --environment esp32
6060
- `manual-YYYYMMDD-HHMMSS` - Manual workflow dispatch builds
6161
- `YYYY.MM.DD` - Date-based version tags
6262

63+
All published images are signed using [Cosign](https://github.com/sigstore/cosign) for supply chain security. You can verify image signatures using:
64+
65+
```bash
66+
cosign verify ghcr.io/jethome-iot/jethome-dev-platformio:latest \
67+
--certificate-identity-regexp=https://github.com/jethome-iot/jethome-dev \
68+
--certificate-oidc-issuer=https://token.actions.githubusercontent.com
69+
```
70+
6371
## Environment Variables
6472

6573
The image sets these PlatformIO environment variables:

0 commit comments

Comments
 (0)