Skip to content

Commit 544ab0e

Browse files
committed
Add release workflow
1 parent 7fee40c commit 544ab0e

File tree

3 files changed

+142
-1
lines changed

3 files changed

+142
-1
lines changed

.github/workflows/release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Sysbox Installer Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
permissions:
9+
attestations: write
10+
id-token: write
11+
contents: write
12+
packages: write
13+
14+
jobs:
15+
build-and-release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Parse version from tag or generate timestamp
22+
run: |
23+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
24+
VERSION=$(date -u +%Y%m%d%H%M%S)
25+
echo "Manual trigger - using timestamp: $VERSION"
26+
else
27+
VERSION=${GITHUB_REF#refs/tags/v}
28+
echo "Tag trigger - parsed version: $VERSION"
29+
fi
30+
echo "VERSION=$VERSION" >> $GITHUB_ENV
31+
32+
- name: Log in to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ vars.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Record Git revision
42+
run: |
43+
echo "GIT_REV=$(git rev-parse HEAD)" >> $GITHUB_ENV
44+
45+
- name: Build and push Docker image
46+
id: build-and-push
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
file: docker/Dockerfile
51+
push: true
52+
tags: ${{ vars.DOCKERHUB_ORG }}/dstack-sysbox-installer:${{ env.VERSION }}
53+
platforms: linux/amd64
54+
provenance: false
55+
build-args: |
56+
DSTACK_REV=${{ env.GIT_REV }}
57+
58+
- name: Generate artifact attestation
59+
uses: actions/attest-build-provenance@v1
60+
with:
61+
subject-name: "docker.io/${{ vars.DOCKERHUB_ORG }}/dstack-sysbox-installer"
62+
subject-digest: ${{ steps.build-and-push.outputs.digest }}
63+
push-to-registry: true
64+
65+
- name: GitHub Release
66+
uses: softprops/action-gh-release@v1
67+
with:
68+
name: "Sysbox Installer Release v${{ env.VERSION }}"
69+
body: |
70+
## Docker Image Information
71+
72+
**Image**: `docker.io/${{ vars.DOCKERHUB_ORG }}/dstack-sysbox-installer:${{ env.VERSION }}`
73+
74+
**Digest (SHA256)**: `${{ steps.build-and-push.outputs.digest }}`
75+
76+
**Verification**: [Verify on Sigstore](https://search.sigstore.dev/?hash=${{ steps.build-and-push.outputs.digest }})
77+
78+
## Installation
79+
80+
```bash
81+
docker run --rm --privileged --pid=host --net=host -v /:/host \
82+
docker.io/${{ vars.DOCKERHUB_ORG }}/dstack-sysbox-installer:${{ env.VERSION }}
83+
```
84+
85+
## Verify Image Attestation
86+
87+
```bash
88+
# Install cosign
89+
curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64"
90+
sudo mv cosign-linux-amd64 /usr/local/bin/cosign
91+
sudo chmod +x /usr/local/bin/cosign
92+
93+
# Verify the image
94+
cosign verify-attestation \
95+
--type https://slsa.dev/provenance/v1 \
96+
--certificate-identity-regexp "^https://github.com/${{ github.repository }}/.github/workflows/release.yml@refs/tags/v${{ env.VERSION }}$" \
97+
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
98+
docker.io/${{ vars.DOCKERHUB_ORG }}/dstack-sysbox-installer@${{ steps.build-and-push.outputs.digest }}
99+
```

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,44 @@ rm -rf /dstack/persistent/sysbox-*
146146
- dstack system with ZFS persistent storage
147147
- systemd for service management
148148

149+
## Release and Verification
150+
151+
### Creating a Release
152+
153+
Releases are automated via GitHub Actions with sigstore attestation:
154+
155+
1. Tag a new version:
156+
```bash
157+
git tag v1.0.0
158+
git push origin v1.0.0
159+
```
160+
161+
2. The workflow will automatically:
162+
- Build the Docker image
163+
- Push to Docker Hub
164+
- Generate sigstore attestation
165+
- Create a GitHub release
166+
167+
### Verifying Image Attestation
168+
169+
All released images are signed with sigstore for supply chain security:
170+
171+
```bash
172+
# Install cosign
173+
curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64"
174+
sudo mv cosign-linux-amd64 /usr/local/bin/cosign
175+
sudo chmod +x /usr/local/bin/cosign
176+
177+
# Verify the image (replace VERSION and DIGEST)
178+
cosign verify-attestation \
179+
--type https://slsa.dev/provenance/v1 \
180+
--certificate-identity-regexp "^https://github.com/YOUR_ORG/dstack-sysbox-installer/.github/workflows/release.yml@refs/tags/vVERSION$" \
181+
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
182+
docker.io/YOUR_ORG/dstack-sysbox-installer@sha256:DIGEST
183+
```
184+
185+
You can also verify on [Sigstore Search](https://search.sigstore.dev/).
186+
149187
## Support
150188

151189
For issues with the installer, check:

docker/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,15 @@ COPY scripts/sysbox-fs.service /usr/local/share/sysbox-fs.service
7777
# Make everything executable
7878
RUN chmod +x /usr/local/bin/*
7979

80+
# Build metadata arguments (final stage)
81+
ARG DSTACK_REV
82+
8083
# Create build info
8184
RUN echo "Sysbox Installer Image" > /usr/local/share/BUILD_INFO && \
8285
echo "Built: $(date)" >> /usr/local/share/BUILD_INFO && \
8386
echo "Sysbox: $(/usr/local/bin/sysbox-mgr --version | head -1)" >> /usr/local/share/BUILD_INFO && \
84-
echo "rsync: $(/usr/local/bin/rsync --version | head -1)" >> /usr/local/share/BUILD_INFO
87+
echo "rsync: $(/usr/local/bin/rsync --version | head -1)" >> /usr/local/share/BUILD_INFO && \
88+
echo "Git Revision: ${DSTACK_REV:-unknown}" >> /usr/local/share/BUILD_INFO
8589

8690
WORKDIR /workspace
8791

0 commit comments

Comments
 (0)