Merge pull request #39 from logan-pugh/python-3-11 #12
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: Python package | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.9] | |
#python-version: [3.6, 3.7, 3.8] | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
version: ${{ matrix.python-version }} | |
- name: calculate Version Tag | |
id: calculateVersionTag | |
run: | | |
VERSIONTAG=$(date +%Y%m.%d.%H%M) | |
echo ::set-output name=VERSIONTAG::${VERSIONTAG} | |
- name: is pull closed merged master python | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: | | |
echo $GITHUB_CONTEXT > gha_context.json | |
curl https://raw.githubusercontent.com/bcgov/bcdc-test/dev/is_pull_request.py --output is_pull_request.py | |
pip install requests==2.25.0 | |
ls -l | |
is_closed_merged_pr=$(python is_pull_request.py gha_context.json) | |
echo "is_closed_merged_pr: $is_closed_merged_pr" | |
if [[ $is_closed_merged_pr == 'True' ]]; | |
then | |
echo is a pr | |
exit 0 | |
else | |
echo is not a pr | |
exit 1 | |
fi | |
- name: Build and Upload | |
if: success() | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
PKG_TYPE: PROD | |
VERSIONTAG: ${{ steps.calculateVersionTag.outputs.VERSIONTAG }} | |
run: | | |
python -m pip install -r requirements_build.txt | |
python --version | |
python setup.py sdist bdist_wheel | |
python -m twine upload dist/* |