publish python package #29
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: publish python package | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "new tag name for release" | |
required: true | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set GitHub Release Tag as Poetry Package Version | |
run: | | |
sed -i -r 's/version *= *".*"/version = "${{ github.event.inputs.tag }}"/g' ./netbox_atlas_plugin/__init__.py | |
sed -i '0,/version =.*/s//version = "'"${{ github.event.inputs.tag }}"'"/' ./pyproject.toml | |
sed -i -r 's/version*= *".*"/version="${{ github.event.inputs.tag }}"/g' ./setup.py | |
shell: bash | |
- name: Commit version to tag branch | |
run: | | |
git branch ${{ github.event.inputs.tag }}-branch | |
git checkout ${{ github.event.inputs.tag }}-branch | |
git add ./netbox_atlas_plugin/__init__.py ./pyproject.toml | |
git config --global user.name "Stefan Hipfel" | |
git config --global user.email "stefan.hipfel@sap.com" | |
git commit -m "Create new release ${{ github.event.inputs.tag }}" --allow-empty | |
git tag v${{ github.event.inputs.tag }} | |
git push origin v${{ github.event.inputs.tag }} | |
shell: bash |