-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.22 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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