fix: No stage out file to S3 if empty #53
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: PR Merge / PYPI | |
on: | |
pull_request: | |
types: [ closed ] | |
env: | |
ARTIFACT_BASE_NAME: mdps-ds-lib | |
PR_NUMBER: ${{ github.event.number }} | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
GH_TOKEN: ${{ github.token }} | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
jobs: | |
if_merged: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
- name: Develop -- Log PR info | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && !(contains(github.event.pull_request.title, 'update version + change log')) && !(contains(github.event.pull_request.title, 'catchup from main')) | |
run: | | |
echo "${PR_TITLE} -- ${PR_NUMBER}" | |
- name: Develop -- Update setup version | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && !(contains(github.event.pull_request.title, 'update version + change log')) && !(contains(github.event.pull_request.title, 'catchup from main')) | |
run: | | |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" FEATURE | |
- name: Develop -- Run version commit script | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && !(contains(github.event.pull_request.title, 'update version + change log')) && !(contains(github.event.pull_request.title, 'catchup from main')) | |
run: | | |
chmod +x "${GITHUB_WORKSPACE}/.ci/update_version_commit.sh" | |
"${GITHUB_WORKSPACE}/.ci/update_version_commit.sh" | |
- name: MAIN -- Log PR info | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && (contains(github.event.pull_request.title, 'RELEASE')) | |
run: | | |
echo "${PR_TITLE} -- ${PR_NUMBER}" | |
- name: MAIN -- Update setup version | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && (contains(github.event.pull_request.title, 'RELEASE')) | |
run: | | |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" RELEASE | |
- name: MAIN -- Run version commit script | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && (contains(github.event.pull_request.title, 'RELEASE')) | |
run: | | |
chmod +x "${GITHUB_WORKSPACE}/.ci/update_version_commit.sh" | |
"${GITHUB_WORKSPACE}/.ci/update_version_commit.sh" main | |
- name: Develop -- Install dependencies | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 -m pip install poetry twine | |
- name: Develop -- Build the project | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 -m poetry build | |
- name: Develop -- Upload to PyPI | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 -m twine upload --repository pypi dist/* | |
- name: MAIN -- Install dependencies | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 -m pip install poetry twine | |
- name: MAIN -- Build the project | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 -m poetry build | |
- name: MAIN -- Upload to PyPI | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 -m twine upload --repository pypi dist/* | |
- name: MAIN -- Catch up PR | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
chmod +x "${GITHUB_WORKSPACE}/.ci/catchup_pr.sh" | |
"${GITHUB_WORKSPACE}/.ci/catchup_pr.sh" | |
- name: MAIN -- Upload to PyPI | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
# make file runnable, might not be necessary | |
chmod +x "${GITHUB_WORKSPACE}/.ci/store_version.sh" | |
"${GITHUB_WORKSPACE}/.ci/store_version.sh" | |
- name: MAIN -- Create Release Body | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
run: | | |
python3 "${GITHUB_WORKSPACE}/.ci/update_setup_version.py" RELEASE_BODY | |
- name: MAIN -- Create Release | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && contains(github.event.pull_request.title, 'update version + change log') | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: "v${{ env.software_version }}" | |
release_name: "Release v${{ env.software_version }} - ${{ github.ref }}" | |
body_path: ./release_body.txt | |
draft: false | |
prerelease: false |