Skip to content

fix tag parsing

fix tag parsing #4

Workflow file for this run

name: Publish Python Package
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
publish_pypi:
name: Publish to PyPi
runs-on: ubuntu-20.04
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
environment:
name: pypi
url: https://pypi.org/p/multi_mst
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -U pyyaml
- name: Download sdist
uses: dawidd6/[email protected]
with:
github_token: ${{ secrets.PUSH_TOKEN }}
workflow: Tests.yml
workflow_conclusion: success
branch: main
path: .
- name: Extract version
id: version
run: |
TAG=${{ github.ref }}
VERSION=${TAG#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Move files to dist
run: |
mkdir dist
mv sdist/* dist/
if [[ ! -f dist/multi_mst-${{ steps.version.outputs.version }}.tar.gz ]] ; then exit 1; fi
- name: Make github release
id: make_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
release_name: "Version ${{ steps.version.outputs.version }}"
tag_name: ${{ steps.version.outputs.tag }}
body: "**Full Changelog**: https://github.com/vda-lab/multi_mst/commits/${{ steps.version.outputs.tag }}"
- name: Upload source distribution
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.make_release.outputs.upload_url }}
asset_path: dist/*
asset_name: multi_mst-${{ steps.version.outputs.version }}.tar.gz
asset_content_type: application/gzip
- name: Publish package to (Test)PyPI
uses: pypa/[email protected]
# Comment lines below to publish to PyPi instead of test PyPi
# with:
# repository-url: https://test.pypi.org/legacy/