-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:CartoDB/raster-loader
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Publish package to PyPI | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.9 | ||
- name: Get release version | ||
run: | | ||
echo "CHANGELOG_VERSION=$(cat CHANGELOG.md | grep -oP '(?<=##\s)(.*)(?=\])' | head -n 1 | sed 's/\[/v/g')" >> $GITHUB_ENV | ||
echo "TAG_VERSION=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV | ||
- name: Check changelog release version | ||
if: ${{ env.TAG_VERSION != env.CHANGELOG_VERSION }} | ||
run: | | ||
echo "CHANGELOG_VERSION($CHANGELOG_VERSION) is different from TAG_VERSION($TAG_VERSION)" | ||
exit 1 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Get all git tags | ||
run: git fetch --tags -f | ||
- name: Build package | ||
run: | | ||
python -m build --sdist --wheel | ||
- name: Get package size | ||
run: echo "PKG_SIZE=$(find dist -maxdepth 1 -regex '.*gz' | xargs stat --format='%s')" >> $GITHUB_ENV | ||
- name: Check package size | ||
if: ${{ env.PKG_SIZE > 1e+8 }} | ||
run: | | ||
echo "PKG_SIZE($PKG_SIZE bytes) is greater than 100MB" | ||
exit 1 | ||
- name: Publish package | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
skip_existing: true | ||
password: ${{ secrets.PYPI_API_TOKEN }} |