generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 17
70 lines (67 loc) · 2.2 KB
/
draft_release.yml
File metadata and controls
70 lines (67 loc) · 2.2 KB
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
name: 'Release Draft'
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
permissions:
actions: write
deployments: write
packages: write
pull-requests: write
repository-projects: write
contents: write
jobs:
python-wrapper-release-gh-draft:
name: 'Build And Release Draft'
runs-on: ubuntu-latest
environment:
name: draft_release
url: https://test.pypi.org/project/aws-advanced-python-wrapper/
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: 'Set up Python 3.11'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install poetry
shell: bash
run: |
pipx install poetry==1.8.2
poetry config virtualenvs.prefer-active-python true
- name: 'Install dependencies'
run: poetry install
- name: 'Run mypy - static type checking'
run: poetry run mypy .
- name: 'Run flake8 - linting'
run: poetry run flake8 .
- name: 'Run isort - dependency import sorting check'
run: poetry run isort --check-only .
- name: 'Run unit tests'
run: poetry run pytest ./tests/unit -Werror
- name: 'Set Version Env Variable'
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Get Release Details'
run: |
export RELEASE_DETAILS="$(awk -vN=2 'n<N;/^## /{++n}' CHANGELOG.md)"
export RELEASE_DETAILS="$(sed '${/^# /d;}' <<< "$RELEASE_DETAILS")"
export RELEASE_DETAILS="$(sed '$d' <<< "$RELEASE_DETAILS")"
touch RELEASE_DETAILS.md
echo "$RELEASE_DETAILS" > RELEASE_DETAILS.md
- name: 'Create a Package'
run: poetry build
- name: 'Upload to TestPyPI'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: 'Create a Draft Release'
if: always()
uses: ncipollo/release-action@v1
with:
draft: true
name: "AWS Advanced Python Wrapper - v${{ env.RELEASE_VERSION }}"
bodyFile: RELEASE_DETAILS.md
artifacts: ./dist/*
token: ${{ secrets.GITHUB_TOKEN }}