-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (48 loc) · 1.71 KB
/
generate-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 }}