-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.32 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Package, Tag and Release
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
build:
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' # Specify your Python version here
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
- name: Install Podman
run: |
sudo apt-get update
sudo apt-get -y install podman
- name: Install dependencies
run: poetry install
- name: Run your command with Poetry
run: poetry run crzd build
- name: Extract version from pyproject.toml
id: extract_version
run: |
VERSION=$(grep -E '^version\s*=' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create and push tag
env:
VERSION: ${{ env.VERSION }}
run: |
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: Delete existing GitHub release if it exists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
run: |
gh auth login
if gh release view "v$VERSION" >/dev/null 2>&1; then
gh release delete "v$VERSION" -y
else
echo "Release for tag v$VERSION not found, skipping delete."
fi
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.VERSION }}"
release_name: "v${{ env.VERSION }}"
draft: false
prerelease: false
- name: Upload wheel file to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/*.whl
asset_name: containerized_v${{ env.VERSION }}.whl
asset_content_type: application/octet-stream