This repository was archived by the owner on Dec 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +21
-34
lines changed Expand file tree Collapse file tree 5 files changed +21
-34
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,9 @@ jobs:
121121 python-version : [3.6, 3.7, 3.8]
122122 steps :
123123 - uses : actions/checkout@v2
124+ - name : Get short SHA for the commit being used
125+ run : |
126+ echo "GH_SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
124127 - name : Build Docker image
125128 run : |
126129 docker-compose build \
@@ -137,11 +140,12 @@ jobs:
137140 # to upload a single file as an artifact.
138141 - name : Unzip generated zip
139142 run : |
140- unzip ${{ github.event.repository.name }}* .zip \
143+ unzip ${{ github.event.repository.name }}.zip \
141144 -d lambda_zip_contents
142145 - name : Upload artifacts
143146 uses : actions/upload-artifact@v2
144147 with :
145- name : " ${{ github.event.repository.name }}-${{ github.sha }}-\
146- py${{ matrix.python-version }}"
148+ name : " ${{ github.event.repository.name }}-\
149+ py${{ matrix.python-version }}-\
150+ ${{ env.GH_SHORT_SHA }}"
147151 path : lambda_zip_contents/
Original file line number Diff line number Diff line change 77
88env :
99 PIP_CACHE_DIR : ~/.cache/pip
10- PY_VERSION : 3.8
1110jobs :
1211 release :
1312 runs-on : ubuntu-latest
14- env :
15- ASSET_NAME : ${{ github.event.repository.name }}.zip
13+ strategy :
14+ matrix :
15+ # Versions supported by AWS and lambci/lambda images
16+ python-version : [3.6, 3.7, 3.8]
1617 steps :
1718 - uses : actions/checkout@v2
1819 - name : Build Docker image
1920 run : " docker-compose build \
20- --build-arg PY_VERSION=${{ env.PY_VERSION }} \
21- --build-arg FILE_NAME=${{ github.event.repository.name }} \
22- --build-arg IS_RELEASE=TRUE"
21+ --build-arg PY_VERSION=${{ matrix.python-version }} \
22+ --build-arg FILE_NAME=${{ github.event.repository.name }}"
2323 - name : Generate lambda zip
2424 run : docker-compose up
2525 - name : Upload lambda zip as release asset
2828 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2929 with :
3030 upload_url : ${{ github.event.release.upload_url }}
31- asset_path : ${{ env.ASSET_NAME }}
32- asset_name : ${{ env.ASSET_NAME }}
31+ asset_path : " ${{ github.event.repository.name }}.zip"
32+ asset_name : " ${{ github.event.repository.name }}-\
33+ ${{ matrix.python-version }}.zip"
3334 asset_content_type : application/zip
Original file line number Diff line number Diff line change 44.pytest_cache
55.python-version
66__pycache__
7- skeleton-aws-lambda * .zip
7+ skeleton-aws-lambda.zip
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ ARG IS_RELEASE=FALSE
1111
1212ENV BUILD_PY_VERSION=$PY_VERSION
1313ENV BUILD_FILE_NAME=$FILE_NAME
14- ENV BUILD_IS_RELEASE=$IS_RELEASE
1514
1615COPY build.sh .
17- COPY bump_version.sh .
1816
1917COPY lambda_handler.py .
2018
Original file line number Diff line number Diff line change @@ -22,32 +22,16 @@ function check_dependencies {
2222 done
2323}
2424
25- PY_VERSION=" 3.8"
26- FILE_NAME=" skeleton-aws-lambda"
27-
2825check_dependencies
2926
30- if [ -n " $BUILD_PY_VERSION " ]
31- then
32- PY_VERSION=" $BUILD_PY_VERSION "
33- fi
34-
35- if [ -n " $BUILD_FILE_NAME " ]
36- then
37- FILE_NAME=" $BUILD_FILE_NAME "
38- fi
39-
40- LAMBDA_VERSION=$( ./bump_version.sh show)
27+ PY_VERSION=" ${BUILD_PY_VERSION:- 3.8} "
28+ # Use the current directory name
29+ FILE_NAME=" ${BUILD_FILE_NAME:- ${PWD##*/ } } "
4130
4231# ##
4332# Define the name of the Lambda zip file being produced.
4433# ##
45- if [ -n " $BUILD_IS_RELEASE " ] && [ " $BUILD_IS_RELEASE " == " TRUE" ]
46- then
47- ZIP_FILE=" ${FILE_NAME} .zip"
48- else
49- ZIP_FILE=" ${FILE_NAME} _${LAMBDA_VERSION} _py${PY_VERSION} .zip"
50- fi
34+ ZIP_FILE=" ${FILE_NAME} .zip"
5135
5236# ##
5337# Set up the Python virtual environment.
You can’t perform that action at this time.
0 commit comments