Merge pull request #8 from OpenIPC/improvements #23
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: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # This triggers the workflow on tags following semantic versioning | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Get version from tag | |
id: vars | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel setuptools-scm | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Create Release | |
id: create_release | |
run: | | |
if [[ "${GITHUB_REF}" == "refs/tags/v"* ]]; then | |
TAG_NAME=${GITHUB_REF#refs/tags/} | |
if [[ "${GITHUB_REF}" == "refs/tags/v"* ]]; then | |
echo "Creating release for tag $TAG_NAME" | |
echo "GITHUB_REF=$GITHUB_REF" >> $GITHUB_ENV | |
fi | |
else | |
echo "Not a valid tag, skipping release creation." | |
exit 0 | |
fi | |
- name: Upload Package to Release | |
if: steps.create_release.outputs.tag_name != '' | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.create_release.outputs.tag_name }} | |
files: | | |
dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |