@@ -2,7 +2,7 @@ name: Build DAppNode AMI
22
33on :
44 workflow_run :
5- workflows : ["Pre-release "]
5+ workflows : ["Release "]
66 types : [completed]
77
88permissions :
@@ -15,72 +15,35 @@ jobs:
1515 runs-on : ubuntu-latest
1616 if : ${{ github.event.workflow_run.conclusion == 'success' }}
1717 steps :
18- - name : Get release tag
19- id : tag
20- env :
21- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22- run : |
23- # Get the latest pre-release tag (the one just created by the triggering workflow)
24- TAG=$(gh release list --repo ${{ github.repository }} \
25- --limit 1 --json tagName --jq '.[0].tagName')
26- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
27- echo "Release tag: $TAG"
28-
2918 - name : Configure AWS credentials via OIDC
3019 uses : aws-actions/configure-aws-credentials@v4
3120 with :
3221 role-to-assume : ${{ secrets.IMAGE_BUILDER_ROLE_ARN }}
3322 aws-region : us-east-1
3423
35- - name : Create component, recipe, and trigger AMI build
24+ - name : Bump recipe and trigger AMI build
3625 env :
3726 PIPELINE_ARN : ${{ secrets.IMAGE_BUILDER_PIPELINE_ARN }}
3827 INFRA_ARN : ${{ secrets.IMAGE_BUILDER_INFRA_ARN }}
3928 DIST_ARN : ${{ secrets.IMAGE_BUILDER_DIST_ARN }}
40- TAG : ${{ steps.tag.outputs.tag }}
4129 run : |
42- PROFILE_URL="https://github.com/dappnode/DAppNode/releases/download/${TAG}/dappnode_profile.sh"
43- SCRIPT_URL="https://raw.githubusercontent.com/dappnode/DAppNode/${TAG}/scripts/dappnode_ami_build.sh"
44-
45- # Derive component version from tag (v0.2.47 -> 0.2.47)
46- COMP_VERSION="${TAG#v}"
47-
48- # Create per-release component (thin wrapper: downloads repo script and runs it)
49- COMPONENT_ARN=$(aws imagebuilder create-component \
50- --name "dappnode-build" \
51- --semantic-version "$COMP_VERSION" \
52- --platform "Linux" \
53- --supported-os-versions "Ubuntu" \
54- --data "$(cat <<EOF
55- name: DAppNodeBuild
56- schemaVersion: 1.0
57- phases:
58- - name: build
59- steps:
60- - name: RunBuildScript
61- action: ExecuteBash
62- inputs:
63- commands:
64- - |
65- export PROFILE_URL="${PROFILE_URL}"
66- wget -O /tmp/dappnode_ami_build.sh "${SCRIPT_URL}"
67- chmod +x /tmp/dappnode_ami_build.sh
68- /tmp/dappnode_ami_build.sh
69- EOF
70- )" \
71- --query 'componentBuildVersionArn' --output text)
72- echo "Component: $COMPONENT_ARN"
73-
74- # Get current recipe version and patch bump
75- CURRENT_RECIPE=$(aws imagebuilder get-image-pipeline \
30+ # Get current recipe and extract component + version
31+ CURRENT_RECIPE_ARN=$(aws imagebuilder get-image-pipeline \
7632 --image-pipeline-arn "$PIPELINE_ARN" \
7733 --query 'imagePipeline.imageRecipeArn' --output text)
78- CURRENT_VERSION=$(echo "$CURRENT_RECIPE" | grep -oP '[0-9]+\.[0-9]+\.[0-9]+$')
34+
35+ CURRENT_VERSION=$(echo "$CURRENT_RECIPE_ARN" | grep -oP '[0-9]+\.[0-9]+\.[0-9]+$')
7936 IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
8037 NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
8138 echo "Recipe: $CURRENT_VERSION -> $NEW_VERSION"
8239
83- # Create recipe with per-release component
40+ # Get component from current recipe
41+ COMPONENT_ARN=$(aws imagebuilder get-image-recipe \
42+ --image-recipe-arn "$CURRENT_RECIPE_ARN" \
43+ --query 'imageRecipe.components[0].componentArn' --output text)
44+ echo "Component: $COMPONENT_ARN"
45+
46+ # Create new recipe version (same component, latest Ubuntu 24)
8447 RECIPE_ARN=$(aws imagebuilder create-image-recipe \
8548 --name "dappnode-image" \
8649 --semantic-version "$NEW_VERSION" \
10366 --query 'imageBuildVersionArn' --output text)
10467
10568 echo "### AMI Build Triggered 🚀" >> "$GITHUB_STEP_SUMMARY"
106- echo "- **Tag:** ${TAG}" >> "$GITHUB_STEP_SUMMARY"
10769 echo "- **Recipe:** ${NEW_VERSION}" >> "$GITHUB_STEP_SUMMARY"
108- echo "- **Profile:** ${PROFILE_URL}" >> "$GITHUB_STEP_SUMMARY"
10970 echo "- **Image ARN:** ${EXECUTION}" >> "$GITHUB_STEP_SUMMARY"
0 commit comments