From b0110a725720f38ced1582f7a366931e2c59bc50 Mon Sep 17 00:00:00 2001 From: Franco Rezabek Date: Wed, 9 Dec 2020 17:40:51 +0000 Subject: [PATCH] Add GitHub actions release.yaml --- .github/workflows/release.yaml | 48 ++++++++++++++++++++++++++++++++++ requirements.txt | 2 -- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6e3e7c0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +--- +name: Release Version +on: + push: + branches: + - main +jobs: + release: + name: Release Version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true + # Cache + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + # Setup + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: pip install -r requirements.txt + # Release if required + - name: Set up versions in env variables + id: version + run: | + function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + echo "THIS_VERSION=$(make version | sed s/^v//)" >> $GITHUB_ENV + echo "THIS_VERSION_COMPARABLE=$(version $(make version | sed s/^v//))" >> $GITHUB_ENV + 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 + - name: Create Release + id: create_release + uses: actions/create-release@latest + if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + with: + tag_name: v${{ env.THIS_VERSION }} + release_name: Release v${{ env.THIS_VERSION }} + body: | + See the CHANGELOG for a list of features included in this release + draft: false + prerelease: true diff --git a/requirements.txt b/requirements.txt index 5c90b4d..d3ba102 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ awscli -boto3 -boto3-stubs bump2version pre-commit