RAT Toolbox Module Added (v3.0.8 after v3.0.7) #45
Workflow file for this run
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
name: publish-to-pypi | |
on: | |
release: | |
types: [ created ] | |
jobs: | |
build: | |
name: Build and Publish to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install pypa/build | |
run: >- | |
python -m pip install build --user | |
- name: Extract tag name | |
id: tag | |
run: | | |
# from refs/tags/v1.2.3 get 1.2.3 | |
VERSION=$(echo $GITHUB_REF | sed 's#.*/##') | |
PLACEHOLDER='version = \"develop\"' | |
VERSION_FILE1='setup.py' | |
VERSION_FILE2='pyproject.toml' | |
echo "VERSION=$VERSION" | |
echo "PLACEHOLDER=$PLACEHOLDER" | |
echo "VERSION_FILE1=$VERSION_FILE1" | |
echo "VERSION_FILE2=$VERSION_FILE2" | |
# ensure the placeholder is there. If grep doesn't find the placeholder | |
# it exits with exit code 1 and github actions aborts the build. | |
grep "$PLACEHOLDER" "$VERSION_FILE1" | |
grep "$PLACEHOLDER" "$VERSION_FILE2" | |
sed -i "s/$PLACEHOLDER/version = \"${VERSION}\"/g" "$VERSION_FILE1" | |
sed -i "s/$PLACEHOLDER/version = \"${VERSION}\"/g" "$VERSION_FILE2" | |
shell: bash | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m build --sdist --wheel --outdir dist/ . | |
- name: Upload artifact to GA | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
retention-days: 5 | |
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` | |
publish: | |
name: Publish distribution to PyPI | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Upload to artifact PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true |