Skip to content

Commit b0110a7

Browse files
committed
Add GitHub actions release.yaml
1 parent 5cdd731 commit b0110a7

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

.github/workflows/release.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Release Version
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
release:
9+
name: Release Version
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
14+
# Cache
15+
- uses: actions/cache@v1
16+
with:
17+
path: ~/.cache/pip
18+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
19+
restore-keys: |
20+
${{ runner.os }}-pip-
21+
# Setup
22+
- name: Set up Python 3.7
23+
uses: actions/setup-python@v1
24+
with:
25+
python-version: 3.7
26+
- name: Install dependencies
27+
run: pip install -r requirements.txt
28+
# Release if required
29+
- name: Set up versions in env variables
30+
id: version
31+
run: |
32+
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
33+
echo "THIS_VERSION=$(make version | sed s/^v//)" >> $GITHUB_ENV
34+
echo "THIS_VERSION_COMPARABLE=$(version $(make version | sed s/^v//))" >> $GITHUB_ENV
35+
echo "LATEST_VERSION_COMPARABLE=$(version $(git describe --tags $(git rev-list --tags --max-count=1) | sed s/^v// 2> /dev/null || echo '0'))" >> $GITHUB_ENV
36+
- name: Create Release
37+
id: create_release
38+
uses: actions/create-release@latest
39+
if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
42+
with:
43+
tag_name: v${{ env.THIS_VERSION }}
44+
release_name: Release v${{ env.THIS_VERSION }}
45+
body: |
46+
See the CHANGELOG for a list of features included in this release
47+
draft: false
48+
prerelease: true

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
awscli
2-
boto3
3-
boto3-stubs
42
bump2version
53
pre-commit

0 commit comments

Comments
 (0)