|
1 | 1 | name: Pre-release |
| 2 | + |
| 3 | +permissions: |
| 4 | + id-token: write |
| 5 | + contents: write |
| 6 | + |
2 | 7 | on: |
3 | 8 | workflow_dispatch: |
4 | 9 | inputs: |
@@ -262,3 +267,57 @@ jobs: |
262 | 267 | body_path: CHANGELOG.md |
263 | 268 | env: |
264 | 269 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 270 | + |
| 271 | + build-ami: |
| 272 | + name: Build DAppNode AMI |
| 273 | + runs-on: ubuntu-latest |
| 274 | + needs: release |
| 275 | + steps: |
| 276 | + - name: Configure AWS credentials via OIDC |
| 277 | + uses: aws-actions/configure-aws-credentials@v4 |
| 278 | + with: |
| 279 | + role-to-assume: ${{ secrets.IMAGE_BUILDER_ROLE_ARN }} |
| 280 | + aws-region: us-east-1 |
| 281 | + |
| 282 | + - name: Bump recipe version and trigger AMI build |
| 283 | + env: |
| 284 | + PIPELINE_ARN: ${{ secrets.IMAGE_BUILDER_PIPELINE_ARN }} |
| 285 | + INFRA_ARN: ${{ secrets.IMAGE_BUILDER_INFRA_ARN }} |
| 286 | + DIST_ARN: ${{ secrets.IMAGE_BUILDER_DIST_ARN }} |
| 287 | + COMPONENT_ARN: ${{ secrets.IMAGE_BUILDER_COMPONENT_ARN }} |
| 288 | + run: | |
| 289 | + # Get current recipe version and patch bump |
| 290 | + CURRENT_RECIPE=$(aws imagebuilder get-image-pipeline \ |
| 291 | + --image-pipeline-arn "$PIPELINE_ARN" \ |
| 292 | + --query 'imagePipeline.imageRecipeArn' --output text) |
| 293 | + CURRENT_VERSION=$(echo "$CURRENT_RECIPE" | grep -oP '[0-9]+\.[0-9]+\.[0-9]+$') |
| 294 | + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" |
| 295 | + NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" |
| 296 | + echo "Bumping recipe: $CURRENT_VERSION -> $NEW_VERSION" |
| 297 | +
|
| 298 | + # Create new recipe version (same component, fresh Ubuntu 24 base) |
| 299 | + RECIPE_ARN=$(aws imagebuilder create-image-recipe \ |
| 300 | + --name "dappnode-image" \ |
| 301 | + --semantic-version "$NEW_VERSION" \ |
| 302 | + --parent-image "arn:aws:imagebuilder:us-east-1:aws:image/ubuntu-server-24-lts-x86/x.x.x" \ |
| 303 | + --components "[{\"componentArn\":\"$COMPONENT_ARN\"}]" \ |
| 304 | + --block-device-mappings '[{"deviceName":"/dev/sda1","ebs":{"volumeSize":8,"volumeType":"gp2","deleteOnTermination":true}}]' \ |
| 305 | + --working-directory "/tmp" \ |
| 306 | + --query 'imageRecipeArn' --output text) |
| 307 | +
|
| 308 | + # Update pipeline and trigger build |
| 309 | + aws imagebuilder update-image-pipeline \ |
| 310 | + --image-pipeline-arn "$PIPELINE_ARN" \ |
| 311 | + --image-recipe-arn "$RECIPE_ARN" \ |
| 312 | + --infrastructure-configuration-arn "$INFRA_ARN" \ |
| 313 | + --distribution-configuration-arn "$DIST_ARN" \ |
| 314 | + --image-tests-configuration "imageTestsEnabled=false" |
| 315 | +
|
| 316 | + EXECUTION=$(aws imagebuilder start-image-pipeline-execution \ |
| 317 | + --image-pipeline-arn "$PIPELINE_ARN" \ |
| 318 | + --query 'imageBuildVersionArn' --output text) |
| 319 | +
|
| 320 | + echo "🚀 AMI build started: $EXECUTION (recipe $NEW_VERSION)" |
| 321 | + echo "### AMI Build Triggered" >> "$GITHUB_STEP_SUMMARY" |
| 322 | + echo "- **Recipe version:** $NEW_VERSION" >> "$GITHUB_STEP_SUMMARY" |
| 323 | + echo "- **Image ARN:** $EXECUTION" >> "$GITHUB_STEP_SUMMARY" |
0 commit comments