fix: Authenticate with aws before and after training #10
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
name: ML Pipeline | |
on: | |
push: | |
branches: | |
- main | |
env: | |
AWS_REGION: eu-west-2 | |
AWS_BUCKET_NAME: c2k | |
AWS_ROLE: ${{ secrets.AWS_ROLE }} | |
jobs: | |
train_and_upload: | |
name: Train and Upload | |
runs-on: ubuntu-latest | |
environment: production | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: ${{ env.AWS_ROLE }} | |
role-session-name: GithubActionsC2KSession | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Train | |
run: | | |
pip install -r requirements.txt | |
python ci_train_and_upload.py train | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: ${{ env.AWS_ROLE }} | |
role-session-name: GithubActionsC2KSession | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Upload to S3 | |
run: | | |
python ci_train_and_upload.py upload |