Created
March 21, 2024 16:58
-
-
Save tosinonikute/d002a75162aa55c80eed0387ed433686 to your computer and use it in GitHub Desktop.
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: Install and Configure AWS CLI | |
on: [push] | |
jobs: | |
install_configure_aws_cli: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install AWS CLI using pip | |
run: | | |
python -m pip install --upgrade pip | |
pip install awscli | |
- name: Configure AWS CLI | |
run: | | |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws configure set region ${{ secrets.AWS_DEFAULT_REGION }} | |
aws configure set output ${{ secrets.AWS_DEFAULT_OUTPUT }} | |
- name: Generate AWS CodeArtifact token | |
id: generate_token | |
run: | | |
# Run AWS CLI command to generate CodeArtifact token | |
CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token --domain my-domain --domain-owner 123456789012 --query authorizationToken --output text) | |
echo "$CODEARTIFACT_TOKEN" # Output the token | |
- name: Store AWS CodeArtifact token in environment variable | |
env: | |
CODEARTIFACT_TOKEN: ${{ steps.generate_token.outputs.codeartifact_token }} | |
run: | | |
echo "CODEARTIFACT_TOKEN=$CODEARTIFACT_TOKEN" >> $GITHUB_ENV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment