-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (93 loc) · 3.12 KB
/
release.yml
File metadata and controls
104 lines (93 loc) · 3.12 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release Build - Highflame Python
on:
release:
types:
- published
env:
PY_VER: 3.11.8
RELEASE_BRANCH: "main"
REGEX_PATTERN: "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
RELEASE_NAME: ${{ github.event.release.name }}
jobs:
highflame-validate:
permissions:
contents: 'read'
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: true
# - name: Validate Release Branch
# id: validate_branch
# shell: bash
# run: |-
# export TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
# export TAG_BRANCH=$(git branch -r --contains ${TAG_COMMIT} | grep -v HEAD | head -n 1 | sed 's/origin\///' | sed 's/^[ \t]*//')
# if [[ "${TAG_BRANCH}" == "${{ env.RELEASE_BRANCH }}" ]] ; then
# echo "Valid Branch for Release : ${TAG_BRANCH}"
# echo "enable_branch_build=true" >> ${GITHUB_OUTPUT}
# else
# echo "Invalid Branch for Release : ${TAG_BRANCH}"
# echo "enable_branch_build=false" >> ${GITHUB_OUTPUT}
# exit 1
# fi
- name: Validate Release Tag
# if: ${{ steps.validate_branch.outputs.enable_branch_build == 'true' }}
id: validate_tag
shell: bash
run: |-
if [[ "${{ env.RELEASE_NAME }}" =~ ${{ env.REGEX_PATTERN }} ]] ; then
echo "Valid version format: ${{ env.RELEASE_NAME }}"
echo "enable_tag_build=true" >> ${GITHUB_OUTPUT}
else
echo "Invalid version format: ${{ env.RELEASE_NAME }}"
echo "enable_tag_build=false" >> ${GITHUB_OUTPUT}
exit 1
fi
highflame-package:
needs:
- highflame-validate
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setting up the Package Version
env:
PY_VER_FILE: "pyproject.toml"
RELEASE_NAME: ${{ github.event.release.name }}
shell: bash
run: |-
export RELEASE_VERSION=$(echo ${{ env.RELEASE_NAME }} | sed 's|^v||g')
if [[ -f ${{ env.PY_VER_FILE }} ]] ; then
sed -i "s|^version = \".*\"|version = \"${RELEASE_VERSION}\"|g" ${{ env.PY_VER_FILE }}
cat ${{ env.PY_VER_FILE }}
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ${{ env.PY_VER_FILE }}"
else
echo "File not found ${{ env.PY_VER_FILE }}"
exit 1
fi
- name: Set up Python Version
uses: actions/setup-python@v6
with:
python-version: ${{ env.PY_VER }}
cache: 'pip'
- name: Install Dependencies
shell: bash
run: |-
pip install build
- name: Build Package
shell: bash
run: |-
python -m build
- name: Publish Package
uses: pypa/gh-action-pypi-publish@v1.13.0
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}