-
Notifications
You must be signed in to change notification settings - Fork 6
59 lines (48 loc) · 1.75 KB
/
release.yml
File metadata and controls
59 lines (48 loc) · 1.75 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
name: Publish to PyPI
on:
release:
types: [published]
jobs:
validate-release:
runs-on: ubuntu-latest
steps:
- name: Validate pre-release consistency
env:
TAG_NAME: ${{ github.event.release.tag_name }}
IS_PRERELEASE: ${{ github.event.release.prerelease }}
run: |
PEP440_PRE=$(echo "$TAG_NAME" | grep -qE '(\.dev|a|b|rc)[0-9]+' && echo "true" || echo "false")
if [ "$IS_PRERELEASE" = "true" ] && [ "$PEP440_PRE" = "false" ]; then
echo "::error::GitHub release is marked as pre-release but tag '$TAG_NAME' is a stable version. Use a PEP 440 pre-release suffix (e.g. .dev1, rc1)."
exit 1
fi
if [ "$IS_PRERELEASE" = "false" ] && [ "$PEP440_PRE" = "true" ]; then
echo "::error::Tag '$TAG_NAME' has a pre-release suffix but the GitHub release is not marked as pre-release. Check the 'Set as a pre-release' box."
exit 1
fi
echo "Release consistency check passed: tag=$TAG_NAME, prerelease=$IS_PRERELEASE"
publish:
needs: validate-release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/salesforce-data-customcode/
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install project dependencies
run: poetry install --no-interaction --only main
- name: Build package
run: make package
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --username __token__ --password $PYPI_TOKEN