attempt 6 at container build; #10
This file contains hidden or 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: deploy-aws-lambda | |
on: | |
push: | |
branches: | |
- deploy-test | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# call-test-workflow: | |
# uses: GNS-Science/nshm-github-actions/.github/workflows/python-run-tests.yml@main | |
# with: | |
# operating-systems: "['ubuntu-latest']" | |
# python-versions: "['3.11']" | |
# secrets: inherit | |
deploy: | |
# needs: call-test-workflow | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22] | |
python-version: [3.11] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install and configure Poetry | |
uses: GNS-Science/install-poetry@main | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Ensure latest requiremments.txt | |
run: | | |
poetry self add poetry-plugin-export | |
poetry export --without-hashes --format=requirements.txt > requirements.txt | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
check-latest: true | |
- name: upgrade NPM | |
run: npm install --location=global npm@latest | |
- name: Verify NPM | |
run: npm doctor | |
- name: Install Dependencies | |
run: npm install | |
- name: List packages | |
run: npm ls | |
- name: Serverless Doctor | |
run: npm run-script sls_doctor | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-southeast-2 | |
- name: Login to ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: 461564345538.dkr.ecr.ap-southeast-2.amazonaws.com | |
- name: Serverless Deploy .... | |
env: | |
ENABLE_METRICS: 1 | |
run: | | |
if [[ "${{github.base_ref}}" == "main" || "${{github.ref}}" == 'refs/heads/main' ]]; then | |
STAGE=prod REGION=ap-southeast-2 npm run-script deploy | |
else | |
STAGE=test REGION=ap-southeast-2 npm run-script deploy | |
fi | |