-
Notifications
You must be signed in to change notification settings - Fork 23
51 lines (40 loc) · 1.52 KB
/
python-publish.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
# This workflow will upload a Python Package to PyPi when a Release is created
name: Publish Python Package
on:
release:
types: [published]
permissions:
contents: read
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
jobs:
publish:
name: Publish to PyPi
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Python package dependencies
run: |
poetry config virtualenvs.create false
poetry install --sync --no-interaction
- name: Inject the latest Code Analyzer JAR
run: |
CODE_ANALYZER_URL=$(curl -s https://api.github.com/repos/IBM/codenet-minerva-code-analyzer/releases/latest | jq -r '.assets[] | .browser_download_url')
echo "Downloading: " $CODE_ANALYZER_URL
wget -q $CODE_ANALYZER_URL
echo "Moving codeanalyzer jar to:" ${{ github.workspace }}/cldk/analysis/java/codeanalyzer/jar/
mv codeanalyzer-*.jar ${{ github.workspace }}/cldk/analysis/java/codeanalyzer/jar/
- name: Build package
run: poetry build
- name: Publish package distributions to PyPI
run: poetry publish --username $PYPI_USERNAME --password $PYPI_PASSWORD