Update deploy-pre-release.yml to handle " given by: --- name: Deplo… #13
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: Deploy Pre-Release Artifacts | |
on: | |
push: | |
branches: | |
- develop | |
defaults: | |
run: | |
shell: bash | |
env: | |
LANG: en_US.utf-8 | |
LC_ALL: en_US.utf-8 | |
jobs: | |
bump_version: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10' ] # 3.11+ not supported | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: echo "Installed python version $(python -V)" | |
- name: Install Libraries | |
run: | | |
pip install cmake wheel packaging | |
- name: Fetch all tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Bump version and check tag | |
id: version_and_tag | |
run: | | |
current_version=$(sed -n -e 's/^.*__version__ = //p' setup.py) | |
current_version=$(echo ${current_version} | sed -e "s/'//g") | |
if ! $(git tag -l "v*" = ''); then | |
current_tag=$(git tag -l "v*" | grep --invert-match '-' | sort --reverse -V | sed -n 1p) | |
current_tag=${current_tag#?} | |
else | |
current_tag=v$current_version | |
fi | |
new_version=$(python .github/workflows/versions.py ${current_tag} --prerelease) | |
new_tag=v${new_version} | |
if git tag -l | grep -q "^${new_tag}$"; then | |
echo "Tag ${new_tag} already exists, incrementing..." | |
# Your logic to modify new_tag to make it unique | |
fi | |
echo "NEW_TAG=${new_tag}" >> $GITHUB_ENV | |
- name: Build wheel | |
run: | | |
python setup.py install | |
python setup.py bdist_wheel --plat-name=manylinux1_x86_64 | |
- uses: ncipollo/release-action@v1 | |
if: github.repository_owner == 'VOLTTRON' && env.NEW_TAG != '' | |
with: | |
artifacts: "dist/*.whl" | |
artifactErrorsFailBuild: true | |
generateReleaseNotes: true | |
commit: ${{ github.ref }} | |
prerelease: true | |
tag: ${{ env.NEW_TAG }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish pre-release to pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.repository_owner == 'VOLTTRON' | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} |