-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.42 KB
/
main.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
name: Package, Tag and Release
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Poetry & Podman
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
sudo apt-get update && sudo apt-get -y install podman
- name: Install poetry project dependencies
run: poetry install
- name: Build the project
run: poetry run crzd build
- name: Extract version and create tag
id: version_and_tag
run: |
VERSION=$(grep -E '^version\s*=' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v$VERSION" -m "Version $VERSION"
git push -f origin "v$VERSION"
- name: Upload artifacts to GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
run: |
gh release upload "v${VERSION}" dist/*.whl --clobber || gh release create "v${VERSION}" dist/*.whl