Skip to content

Instantly share code, notes, and snippets.

@tosinonikute
Created March 21, 2024 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tosinonikute/1b1f2e15b2bae01fbbecc3092a5b5ed2 to your computer and use it in GitHub Desktop.
Save tosinonikute/1b1f2e15b2bae01fbbecc3092a5b5ed2 to your computer and use it in GitHub Desktop.
version: 2.1
jobs:
build:
docker:
- image: circleci/python:3.8
steps:
- checkout
# Install AWS CLI
- run:
name: Install AWS CLI
command: |
sudo apt-get update && sudo apt-get install -y awscli
# Configure AWS credentials and region
- run:
name: Configure AWS credentials and region
command: |
aws configure set aws_access_key_id <YOUR_ACCESS_KEY_ID>
aws configure set aws_secret_access_key <YOUR_SECRET_ACCESS_KEY>
aws configure set region <YOUR_AWS_REGION>
aws configure set output <YOUR_OUTPUT_FORMAT>
# Generate AWS CodeArtifact token
- run:
name: Generate AWS CodeArtifact token
command: |
export CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token --domain <YOUR_CODEARTIFACT_DOMAIN> --domain-owner <DOMAIN_OWNER_AWS_ACCOUNT_ID> --query 'authorizationToken' --output text)
# Store token in environment variable
- run:
name: Store token in environment variable
command: |
echo "export CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> $BASH_ENV
source $BASH_ENV
# Display token for verification (optional)
- run:
name: Display token
command: |
echo "CodeArtifact Auth Token: $CODEARTIFACT_AUTH_TOKEN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment