-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
195e26f
commit e84f782
Showing
2 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import boto3 | ||
import os | ||
import urllib.parse | ||
|
||
client = boto3.client('s3') | ||
|
||
bucket = os.environ['S3_BUCKET'] | ||
|
||
response = client.list_objects_v2( | ||
Bucket=bucket, | ||
Prefix='aws-account-automation/' | ||
) | ||
|
||
for o in response['Contents']: | ||
url = f"https://{bucket}.s3.amazonaws.com/{o['Key']}" | ||
print(f"## {o['Key']}") | ||
print(f"* [Quick Deploy URL](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateURL={urllib.parse.quote(url)})") | ||
print(f"* [HTTP URL (latest)]({url})") | ||
print(f"* S3 URL (latest) - s3://{bucket}/{o['Key']}") | ||
print("* Previous Version HTTP URLs:") | ||
r2 = client.list_object_versions( | ||
Bucket=bucket, | ||
Prefix=o['Key'] | ||
) | ||
for v in r2['Versions']: | ||
print(f"\t * [{v['LastModified']} ({v['VersionId']})](https://{bucket}.s3.amazonaws.com/{o['Key']}?versionId={v['VersionId']})") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,12 @@ jobs: | |
aws s3 sync --delete cloudformation/ s3://${S3_BUCKET}/aws-account-automation/ --content-type text/plain | ||
for object in `aws s3api list-objects-v2 --bucket ${S3_BUCKET} --prefix aws-account-automation/ --query Contents[].[Key] --output text` ; do | ||
aws s3api list-object-versions --bucket ${S3_BUCKET} --prefix ${object} --query Versions[].[Key,VersionId,LastModified] --output text --max-items 3 | ||
done | grep -v ^None$ > Latest-Test-Versions.txt | ||
aws s3api list-object-versions --bucket ${S3_BUCKET} --prefix aws-account-automation/ --query Versions[].[Key,VersionId,LastModified] --output text > Test-Versions.txt | ||
.github/workflows/index_files.py > Test-Links.md | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add Test-Versions.txt Test-Latest-Versions.txt | ||
git commit -m "AutoGenerated Object Versions" | ||
git add Test-Links.md | ||
git commit -m "AutoGenerated Links File" | ||
git push | ||
env: | ||
|