Skip to content

Update lambda.tf

Update lambda.tf #48

Workflow file for this run

name: Package Lambda Function
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r lambda/requirements.txt -t lambda/package/
- name: Package Lambda function
run: |
cd lambda/package
cp ../lambda_function.py .
zip -r ../../unity-cs-monitoring-lambda.zip .
- name: Get current version
id: get_version
run: |
VERSION=$(cat version.txt)
echo "CURRENT_VERSION=$VERSION" >> $GITHUB_ENV
IFS='.' read -ra VER <<< "$VERSION"
MAJOR=${VER[0]}
MINOR=${VER[1]}
PATCH=${VER[2]}
NEW_PATCH=$(($PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Increment version and commit
run: |
echo ${{ env.NEW_VERSION }} > version.txt
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add version.txt
git commit -m "Increment version number to ${{ env.NEW_VERSION }}"
git push
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: v${{ env.NEW_VERSION }}
release_name: Release v${{ env.NEW_VERSION }}
body: "This release contains the deployable ZIP file for Unity CS health status lambda"
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./unity-cs-monitoring-lambda.zip
asset_name: unity-cs-monitoring-lambda.zip
asset_content_type: application/zip