Skip to content

[HOTFIX] add updater to 24.11.10 to 25.2 (#775) #72

[HOTFIX] add updater to 24.11.10 to 25.2 (#775)

[HOTFIX] add updater to 24.11.10 to 25.2 (#775) #72

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: publish to pypi
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Semantic release number"
required: true
type: string
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: trigger by tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: trigger by manually input
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: echo "RELEASE_VERSION=${{inputs.version}}" >> $GITHUB_ENV
- name: github environment
run: |
git_hash=$(git rev-parse --short HEAD)
echo "GIT_SHORT_SHA=$git_hash" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: echo action used variables
run: |
echo '${{ toJSON(env) }}'
echo "::notice ::Git Short Sha: ${{env.GIT_SHORT_SHA}}"
echo "::notice ::Git Branch: ${{env.GIT_BRANCH}}"
echo "::notice ::Semantic release number: ${{ env.RELEASE_VERSION }}"
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Pump version number
run: poetry version ${{ env.RELEASE_VERSION }}
- name: check version
run: |
version=$(poetry run python -c "import flow360; print(flow360.__version__)")
publish_version="${{ env.RELEASE_VERSION }}"
publish_version="${publish_version:1}"
if [ "$version" != "$publish_version" ]; then
echo "version ${version}!=${publish_version} in flow360.__version__ does not match to release version ${{ inputs.version }}"
exit 1
fi
- name: Setup pipy token
shell: bash
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi "$PYPI_TOKEN"
- run: poetry build
- run: poetry publish