Skip to content

Instantly share code, notes, and snippets.

@patrixl
Last active April 1, 2023 11:33
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 patrixl/1d00d0a5a3a7acf45dceb6a5ccd37726 to your computer and use it in GitHub Desktop.
Save patrixl/1d00d0a5a3a7acf45dceb6a5ccd37726 to your computer and use it in GitHub Desktop.
name: Dev - holy-lambda function
on:
workflow_dispatch:
pull_request:
paths:
- components/<<component-name>>/*
- bases/<<base-name>>/*
- projects/<<project-name>>/*
branches:
- main
# Setup environment for release
env:
HL_NO_PROFILE: true
SAM_CLI_TELEMETRY: 0
FUNCTION_NAME: <<holy-lambda>>
ENVIRONMENT: <<dev>>
working-directory: projects/<<project-name>>
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: connect to AWS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: <<AWS_REGION>>
role-to-assume: arn:aws:iam::<<AWS_ACCOUNT_ID>>:role/<<github iam role>>
role-session-name: github-actions
- uses: actions/checkout@v3
- name: setup java
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: temurin
- name: setup clojure
uses: DeLaGuardo/setup-clojure@9.5
with:
cli: latest
bb: latest
- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
# key: cljdeps-${{ hashFiles('deps.edn') }}
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
# key: cljdeps-${{ hashFiles('project.clj') }}
# key: cljdeps-${{ hashFiles('build.boot') }}
restore-keys: cljdeps-
- name: compile
working-directory: ${{env.working-directory}}
run: |
bb hl:compile
bb hl:native:executable
- name: prepare SAM application
working-directory: ${{env.working-directory}}
run: |
sam build --config-env ${ENVIRONMENT}
- name: deploy SAM application
working-directory: ${{env.working-directory}}
run: |
sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --config-env ${ENVIRONMENT}
- name: deploy lambda code
working-directory: ${{env.working-directory}}
run: |
aws lambda update-function-code --function-name ${FUNCTION_NAME} --zip-file fileb://.holy-lambda/build/latest.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment