77 version_major :
88 description : ' AlmaLinux major version'
99 required : true
10- default : ' 9 '
10+ default : ' 10 '
1111 type : choice
1212 options :
1313 - kitten_10
1414 - 10
1515 - 9
1616 - 8
1717
18- make_public :
19- description : " Copy AMI to all available AWS regions and make public"
20- required : true
21- type : boolean
22- default : false
23-
2418 notify_mattermost :
2519 description : " Send notification to Mattermost"
2620 required : true
2721 type : boolean
2822 default : true
2923
3024env :
25+ ALMALINUX_AWS_ACCOUNT_ID : 764336703387
3126 PACKER_GITHUB_API_TOKEN : ${{ secrets.GIT_HUB_TOKEN }}
3227
3328jobs :
6055 variant="${{ matrix.variant }}"
6156 variant="${variant^}"
6257 variant="${variant//_/ }"
63- SOURCE_AMI_ID=$(aws ec2 describe-images --owners 764336703387 --query "Images | max_by(@, &CreationDate) | ImageId" --filters "Name=name,Values=AlmaLinux OS ${variant}*${{ matrix.arch }}" --region ${{ vars.AWS_REGION }} --output text)
58+ SOURCE_AMI_ID=$(aws ec2 describe-images --owners ${{ env.ALMALINUX_AWS_ACCOUNT_ID }} --query "Images | max_by(@, &CreationDate) | ImageId" --filters "Name=name,Values=AlmaLinux OS ${variant}*${{ matrix.arch }}" --region ${{ vars.AWS_REGION }} --output text)
6459 if [[ "${SOURCE_AMI_ID}" == "" || "${SOURCE_AMI_ID}" == "None" ]]; then
6560 echo "[Error] Failed to get AMI ID for AlmaLinux ${variant} ${{ matrix.arch }}."
6661 exit 1
@@ -137,36 +132,8 @@ jobs:
137132 core.summary
138133 .addHeading('${{ env.AMI_NAME }}', '4')
139134 .addHeading('AMI ID: ${{ env.AMI_ID }}', '5')
140- .addHeading('Public: ${{ inputs.make_public && '✅' || '❌'}}', '5')
141135 .write()
142136
143- - name : Copy an AMI to all available AWS regions and make it public
144- if : inputs.make_public
145- run : |
146- # Lowercase AMI Name, replace spaces and dots with underscores
147- wiki_data_file="${{ env.AMI_NAME }}"
148- wiki_data_file="${wiki_data_file,,}"
149- wiki_data_file="${wiki_data_file// /_}"
150- wiki_data_file="${wiki_data_file//./_}"
151- echo "wiki_data_file=${wiki_data_file}" >> $GITHUB_ENV
152-
153- pip3 install markdown_table
154-
155- tools/aws_ami_mirror.py \
156- --csv-output ${{ github.workspace }}/${wiki_data_file}.csv \
157- --md-output ${{ github.workspace }}/${wiki_data_file}.md \
158- --ami ${{ env.AMI_ID }}
159-
160- - uses : actions/upload-artifact@v4
161- name : Store Wiki's CSV and Markdown data as artifact
162- if : inputs.make_public
163- with :
164- compression-level : 6
165- path : |
166- almalinux*.csv
167- almalinux*.md
168- name : ${{ env.wiki_data_file }}_wiki_data
169-
170137 - name : Send notification to Mattermost
171138 uses : mattermost/action-mattermost-notify@master
172139 if : inputs.notify_mattermost
@@ -175,8 +142,6 @@ jobs:
175142 MATTERMOST_CHANNEL : ${{ vars.MATTERMOST_CHANNEL }}
176143 MATTERMOST_USERNAME : ${{ github.triggering_actor }}
177144 TEXT : |
178- **${{ env.AMI_NAME }}** AWS AMI, generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
179-
180- :almalinux: **AMI ID**: `${{ env.AMI_ID }}`
145+ :almalinux: **${{ env.AMI_NAME }}** AWS AMI, built by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
181146
182- Public: ${{ inputs.make_public && '✅' || '❌'}}
147+ **AMI ID**: ` ${{ env.AMI_ID }}`
0 commit comments