Skip to content

Commit 9d392da

Browse files
Rangeet PanRangeet Pan
authored andcommitted
add the workflow
1 parent 3aacf63 commit 9d392da

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will upload a Python Package to PyPi when a Release is created
2+
name: Publish Python Package
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
PYPI_USERNAME: __token__
13+
PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
14+
15+
jobs:
16+
publish:
17+
name: Publish to PyPi
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout the code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python 3.11
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.11"
28+
29+
- name: Install Poetry
30+
run: |
31+
curl -sSL https://install.python-poetry.org | python - -y
32+
echo "$HOME/.local/bin" >> $GITHUB_PATH
33+
34+
- name: Install Python package dependencies
35+
run: |
36+
poetry config virtualenvs.create false
37+
poetry install --sync --no-interaction
38+
39+
- name: Inject the latest Code Analyzer JAR
40+
run: |
41+
CODE_ANALYZER_URL=$(curl -s https://api.github.com/repos/IBM/codenet-minerva-code-analyzer/releases/latest | jq -r '.assets[] | .browser_download_url')
42+
echo "Downloading: " $CODE_ANALYZER_URL
43+
wget -q $CODE_ANALYZER_URL
44+
echo "Moving codeanalyzer.jar to:" ${{ github.workspace }}/cldk/analysis/java/codeanalyzer/jar/codeanalyzer.jar
45+
mv codeanalyzer.jar ${{ github.workspace }}/cldk/analysis/java/codeanalyzer/jar/codeanalyzer.jar
46+
47+
- name: Build package
48+
run: poetry build
49+
50+
- name: Publish package distributions to PyPI
51+
run: poetry publish --username $PYPI_USERNAME --password $PYPI_PASSWORD

0 commit comments

Comments
 (0)