CI Pipeline #7
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: Python CI Pipeline | |
on: | |
workflow_dispatch | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
test-and-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Run Linting | |
run: | | |
echo "Running Linter" | |
# Placeholder for lint tool command | |
- name: Run Tests | |
run: | | |
echo "Running tests" | |
# Placeholder for test execution command | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-1 | |
# Package and publish app to build repository. Here S3 is used as the build repository as an example. | |
- name: Package and publish app to build repository | |
run: | | |
echo "Publishing application to build repository..." | |
build_version=$(head -n 1 version) | |
repository_type=snapshots | |
if [["$BRANCH_NAME]}" == 'main' || "$BRANCH_NAME" == release/* ]]; then | |
repository_type=releases | |
fi | |
echo "Branch is $BRANCH_NAME, so uploading build to $repository_type repository" | |
zip python-app-$build_version.zip lambda-s3-dynamodb.py | |
aws s3 cp python-app-$build_version.zip s3://vw-demo-730335502100-build-repository/$repository_type/ |