Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Commit f4295ad

Browse files
committed
Restore simple build script output name
Revert the complicated output name bits from the build script and Actions workflows. Instead the Actions workflows will handle any fancy asset naming.
1 parent a2745ef commit f4295ad

File tree

5 files changed

+21
-34
lines changed

5 files changed

+21
-34
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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/

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ on:
77

88
env:
99
PIP_CACHE_DIR: ~/.cache/pip
10-
PY_VERSION: 3.8
1110
jobs:
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
@@ -28,6 +28,7 @@ jobs:
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

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
.pytest_cache
55
.python-version
66
__pycache__
7-
skeleton-aws-lambda*.zip
7+
skeleton-aws-lambda.zip

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ ARG IS_RELEASE=FALSE
1111

1212
ENV BUILD_PY_VERSION=$PY_VERSION
1313
ENV BUILD_FILE_NAME=$FILE_NAME
14-
ENV BUILD_IS_RELEASE=$IS_RELEASE
1514

1615
COPY build.sh .
17-
COPY bump_version.sh .
1816

1917
COPY lambda_handler.py .
2018

build.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff 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-
2825
check_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.

0 commit comments

Comments
 (0)