Skip to content

Commit

Permalink
Use GitHub OIDC for AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
printfn committed Mar 19, 2024
1 parent 3238994 commit d87af8f
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
rustup component add clippy
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fmt -- --check
- name: Compile icon/resources.res
if: ${{ matrix.platform == 'windows-latest' }}
run: |
Expand All @@ -61,7 +61,7 @@ jobs:
cmd /c "vcvarsall.bat x64 & set" |
foreach {
if ($_ -match "=") {
$v = $_.split("=", 2); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
$v = $_.split("=", 2); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
Expand Down Expand Up @@ -261,17 +261,38 @@ jobs:
path: windows-wix/build/fend-windows-x64.msi
if-no-files-found: error

deploy_telegram:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref == 'refs/heads/main' }}

permissions:
actions: read
id-token: write

environment:
name: telegram-bot
url: https://t.me/fend_calc_bot

steps:
- name: Get AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.ROLE_TO_ASSUME_ARN }}
role-duration-seconds: 900
mask-aws-account-id: true

- name: Deploy Telegram Bot
if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }}
run: |
pwd
ls
./telegram-bot/build.sh
TELEGRAM_BOT_API_TOKEN=${{ secrets.TELEGRAM_BOT_API_TOKEN }} \
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
./telegram-bot/deploy.sh
deploy:
deploy_website:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down

0 comments on commit d87af8f

Please sign in to comment.