-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removing aws keys and adding assume aws role arch
- Loading branch information
1 parent
c51e158
commit 9182ab8
Showing
1 changed file
with
15 additions
and
28 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 |
---|---|---|
|
@@ -10,31 +10,26 @@ on: | |
branches: | ||
- main | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: sa-east-1 | ||
AWS_REGION: sa-east-1 | ||
BUCKET_NAME: caiogomes.me | ||
steps: | ||
- name: Install hugo | ||
run: sudo apt install hugo | ||
|
||
- name: Install aws cli | ||
id: install-aws-cli | ||
uses: unfor19/install-aws-cli-action@v1 | ||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
version: 2 | ||
verbose: false | ||
arch: amd64 | ||
rootdir: "" | ||
workdir: "" | ||
|
||
- name: Set AWS credentials | ||
run: export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} && export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: GitHub_to_AWS_via_FederatedOIDC | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
@@ -51,23 +46,15 @@ jobs: | |
needs: build-and-deploy | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: sa-east-1 | ||
AWS_REGION: sa-east-1 | ||
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | ||
steps: | ||
- name: Install aws cli | ||
id: install-aws-cli | ||
uses: unfor19/install-aws-cli-action@v1 | ||
- name: configure aws credentials | ||
uses: aws-actions/[email protected] | ||
with: | ||
version: 2 | ||
verbose: false | ||
arch: amd64 | ||
rootdir: "" | ||
workdir: "" | ||
|
||
- name: Set AWS credentials | ||
run: export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} && export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: GitHub_to_AWS_via_FederatedOIDC | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Invalidate clodufront distribution | ||
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" |