Skip to content

Commit

Permalink
Merge pull request #65 from threnjen/deploy_config_to_s3
Browse files Browse the repository at this point in the history
Deploy_config_to_s3
  • Loading branch information
threnjen authored Nov 24, 2024
2 parents c398e75 + 1a789e4 commit 828c98f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy_file_to_s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PROD deployment to boardgamegeek user data cleaner

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_GITHUB_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Sync files to S3 bucket
run: |
aws s3 cp config.py s3://${{ secrets.AWS_BUCKET_NAME }}
23 changes: 23 additions & 0 deletions aws_terraform_bgg/iam_github.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ resource "aws_iam_role_policy_attachment" "boardgamegeekscraper_github_cicd_lamb
policy_arn = aws_iam_policy.boardgamegeekscraper_github_cicd_lambda_functions_policy.arn
}

resource "aws_iam_role_policy_attachment" "boardgamegeekscraper_github_cicd_s3_policyGitHubActions_Push_Role_attach" {
role = aws_iam_role.GitHubActions_Push_Role_role.name
policy_arn = aws_iam_policy.boardgamegeekscraper_github_cicd_s3_policy.arn
}

resource "aws_iam_policy" "boardgamegeekscraper_github_cicd_s3_policy" {
name = "boardgamegeekscraper_github_cicd_s3"
path = "/"
policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Sid = "Statement1",
Effect = "Allow",
Action = [
"s3:PutObject"
],
Resource = ["*"]
}
]
})
}

resource "aws_iam_policy" "boardgamegeekscraper_github_cicd_lambda_functions_policy" {
name = "boardgamegeekscraper_github_cicd_lambda_functions"
path = "/"
Expand Down
4 changes: 1 addition & 3 deletions modules/user_data_cleaner/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def _process_file_list(self, file_list_to_process: list) -> list[dict]:
for game_entry in game_entries:

one_game_reviews = self._get_ratings_from_game(game_entry)
print(
f"Number of ratings ID {game_entry['id']}: {len(one_game_reviews)}"
)

self.total_entries += len(one_game_reviews)

all_entries += one_game_reviews
Expand Down

0 comments on commit 828c98f

Please sign in to comment.