-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (78 loc) · 2.44 KB
/
release.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
78
79
80
81
82
83
name: Publish Release on Merge to Master
on:
pull_request:
branches:
- master
types:
- closed
jobs:
publish-release-draft:
if: github.event.pull_request.merged == true
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.MINITRINO_TOKEN }}
run: |-
RELEASE_NOTES=./release-notes/"${GITHUB_HEAD_REF}".md
DESCRIPTION=$(cat "${RELEASE_NOTES}")
if [ ! -f "${RELEASE_NOTES}" ]; then
echo "Release notes file not found at ${RELEASE_NOTES}. Exiting..."
exit 1
fi
echo "Checking if release exists..."
if gh release list | grep -q -e "${GITHUB_HEAD_REF}"; then
echo "Release ${GITHUB_HEAD_REF} found. Deleting release..."
gh release delete "${GITHUB_HEAD_REF}" -y --cleanup-tag
fi
echo "Creating release from branch ${GITHUB_HEAD_REF}..."
gh release create "${GITHUB_HEAD_REF}" \
--prerelease \
--draft=true \
--title "${GITHUB_HEAD_REF}" \
--notes "${DESCRIPTION}" \
--target "${GITHUB_HEAD_REF}"
publish-release:
runs-on: ubuntu-22.04
needs: publish-release-draft
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.MINITRINO_TOKEN }}
run: |-
gh release edit "${GITHUB_HEAD_REF}" \
--prerelease=false \
--draft=false \
--latest
pypi-publish:
runs-on: ubuntu-22.04
needs: publish-release
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |-
pip install wheel twine
- name: Build and check distribution
run: |-
cd src/cli
python setup.py sdist bdist_wheel
twine check dist/*
- name: Publish distribution to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload src/cli/dist/*
- name: Check package
run: |-
pip uninstall -y minitrino
pip install minitrino==${GITHUB_HEAD_REF}
minitrino --help || exit 1