diff --git a/.github/workflows/build_aws_scheduled.yml b/.github/workflows/build_aws_scheduled.yml index 9f8620d..21bb221 100644 --- a/.github/workflows/build_aws_scheduled.yml +++ b/.github/workflows/build_aws_scheduled.yml @@ -55,6 +55,13 @@ jobs: PKR_VAR_source_ami_architecture: ${{ matrix.arch }} PKR_VAR_instance_type: ${{ matrix.arch == 'x86_64' && 't3.micro' || 't4g.micro' }} + - name: Upload manifest + uses: actions/upload-artifact@v3 + with: + path: manifest_aws_${{ matrix.arch }}.json + name: manifest_aws_${{ matrix.arch }}.json + retention-days: 5 + build-govcloud: # Since we run in parallel, let's make sure we use the same timestamp for all jobs needs: timestamp @@ -96,9 +103,46 @@ jobs: PKR_VAR_source_ami_architecture: ${{ matrix.arch }} PKR_VAR_instance_type: ${{ matrix.arch == 'x86_64' && 't3.micro' || 't4g.micro' }} - - name: Upload manifest - uses: actions/upload-artifact@v3 + print-markdown: + needs: [build] + name: Print the AMI IDs in a markdown format + runs-on: ubuntu-latest + steps: + - name: Download x64 manifest + uses: actions/download-artifact@v3 with: - path: manifest_aws.json - name: manifest_aws.json - retention-days: 5 + name: manifest_aws_x86_64.json + + - name: Download arm64 manifest + uses: actions/download-artifact@v3 + with: + name: manifest_aws_arm64.json + + - name: Print in a markdown format + uses: actions/github-script@v6 + with: + script: | + import { readFileSync } from 'fs'; + + var content = readFileSync("./manifest_aws_arm64.json", "utf8"); + var manifest = JSON.parse(content); + + const toPrint = []; + manifest["builds"].forEach((build) => { + const [region, ami] = build["artifact_id"].split(":"); + toPrint.push(`| ${region} | ${ami} |`); + }); + + content = readFileSync("./manifest_aws_x86_64.json", "utf8"); + manifest = JSON.parse(content); + + manifest["builds"].forEach((build, i) => { + const [region, ami] = build["artifact_id"].split(":"); + toPrint[i] = toPrint[i] + ` ${ami} |`; + }); + + console.log("| AWS Region | AMI ID (ARM64) | AMI ID (x86_64) |"); + console.log("|------------------|-------------------------|-------------------------|"); + toPrint.forEach((line) => { + console.log(line); + });