Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct AWS role #69

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/build_scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600

- name: Setup packer
Expand All @@ -50,10 +50,10 @@ jobs:
- name: Build the AWS AMI using Packer (${{ matrix.arch }})
run: packer build aws.pkr.hcl
env:
PKR_VAR_encrypt_boot: false
PKR_VAR_ami_name_prefix: spacelift-${{ needs.timestamp.outputs.timestamp }}
PKR_VAR_source_ami_architecture: ${{ matrix.arch }}
PKR_VAR_instance_type: ${{ matrix.arch == 'x86_64' && 't3.micro' || 't4g.micro' }}
PKR_VAR_encrypt_boot: false
PKR_VAR_ami_name_prefix: spacelift-${{ needs.timestamp.outputs.timestamp }}
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@v4
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
# Technically, we don't need the source code but the git tagging action requires it
- name: Checkout source code
uses: actions/checkout@main

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
Expand All @@ -249,7 +249,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: manifest_aws_arm64.json

# The manifest file look like this:
# "builds": [
# {
Expand All @@ -269,7 +269,7 @@ jobs:

var content = fs.readFileSync("./manifest_aws_arm64.json", "utf8");
var manifest = JSON.parse(content);

const toPrint = [];
manifest["builds"].forEach((build) => {
const regionToAmi = build["artifact_id"].split(",");
Expand All @@ -278,18 +278,18 @@ jobs:
toPrint.push(`| ${region} | ${ami} |`);
});
});

content = fs.readFileSync("./manifest_aws_x86_64.json", "utf8");
manifest = JSON.parse(content);

manifest["builds"].forEach((build) => {
const regionToAmi = build["artifact_id"].split(",");
regionToAmi.forEach((regionToAmi, i) => {
const [region, ami] = regionToAmi.split(":");
toPrint[i] = toPrint[i] + ` ${ami} |`;
});
});

const header = [
"## AWS",
"",
Expand Down Expand Up @@ -324,20 +324,20 @@ jobs:
# "custom_data": null
# }
# ]

- name: Write Azure and GCP AMI IDs to the markdown file
uses: actions/github-script@v7
env:
AZURE_VERSION: ${{ needs.azure.outputs.azure_version }}
with:
script: |
const fs = require("fs");

content = fs.readFileSync("./manifest_gcp.json", "utf8");
manifest = JSON.parse(content);

const gcpLinesToPrint = [];

manifest["builds"].forEach((build) => {
artifact = build["artifact_id"];
if (artifact.indexOf("-us-") > 0) {
Expand All @@ -350,7 +350,7 @@ jobs:
gcpLinesToPrint.push(` - Asia | \`${artifact}\``);
}
});

azureLines = [
"## Azure",
"",
Expand All @@ -369,4 +369,4 @@ jobs:
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
bodyFile: ./body.md
bodyFile: ./body.md