Generate release package #28
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: Generate release package | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'New tag name' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' # install the python version needed | |
cache: 'pip' # caching pip dependencies | |
- name: Install python build requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Extract version from tag | |
id: extractversion | |
shell: bash | |
run: echo "VERSION=$(echo ${{github.event.inputs.tag}} | cut -d "v" -f 2)" >> $GITHUB_OUTPUT | |
- name: Update module version with tag | |
shell: bash | |
run: | | |
ls | |
sed -i -E "s|__version__.*|__version__ = '${{steps.extractversion.outputs.VERSION}}'|g" src/r3threatmodeling/__init__.py | |
git diff | |
cat src/r3threatmodeling/__init__.py | |
- name: Build package | |
run: python -m build | |
- name: Tag release | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "Update version: ${{ github.event.inputs.tag }}" | |
git tag ${{ github.event.inputs.tag }} | |
git push && git push origin ${{ github.event.inputs.tag }} | |
- name: Publish | |
run: gh release create ${{ github.event.inputs.tag }} --verify-tag ./dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |